I'm writing a fairly complex web application that needs to support the download of data in CSV format. I already have a servlet I can query which expects a POST request with JSON in the body describing the data that I want that returns JSON data in response to an XMLHttpRequest.
What I would like to do is duplicate that XmlHttpRequest (against a different servlet URL) which returns the same data in CSV format and would cause the save file dialog to open.
My fear is that the browsers normal response to a "text/plain" MIME type will be suppressed by virtue of the fact that the request originated with XmlHttpRequest.
Is there any way to do what I need?
Another way to do this would be to create an arbitrary POST request (with JSON data as the body) and redirect the browser to it, but I have no idea how to do this.
I'm lucky in that this is a Firefox only app so solutions need not be portable. Thanks in advance.