I have this stupid problem that I am seeing my csv data in the response header but it's not downloading the csv. On client side, I have a button and on it's click an ajax post request is fired like
$.ajax({
url: 'xyz/GenerateCSV',
type: 'POST',
data: postData,
contentType: "application/json; charset=utf-8"
});
On the server side I have set Response as
Response.AddHeader("content-disposition", "attachment;filename=ListExport.csv");
Response.ContentType = "text/csv";
The http response header is coming fine as -
Cache-Control:private
content-disposition:attachment;filename=EncounterListExport.csv
Content-Encoding:gzip
Content-Type:text/csv; charset=utf-8
Date:Mon, 22 Sep 2014 14:18:05 GMT
Server:Microsoft-IIS/8.0
Transfer-Encoding:chunked
Vary:Accept-Encoding
X-AspNet-Version:4.0.30319
X-AspNetMvc-Version:4.0
X-Powered-By:ASP.NET
X-SourceFiles:=?UTF-8?B?
Any idea what's going on? I did not make use of any Form or 'submit' button.
Thanks, Vaibhav