Not sure what I am doing wrong here, but I am passing some data to a controller action for our in house built framework, the way we do ajax calls is just a wrapper for regular ajax calls in Jquery.
CT.postSynch('report/payRollReport/createPayrollReport', {data : data}, function(data){});
The Data I am passing is two dates, which is used to create a csv file. This file would download normally IF I didn't have to select dates, that is if I hard code in the dates to select data between - the csv file will download.
How ever with above method, all I get back is a response that contains the coma delimited string, no file downloads. I am not sure why this is different: it downloads when its not an ajax call and it doesn't when it is an ajax call.
Obviously the headers are set right if it will download when its a regular link....
Any ideas on what I am should do with data
if anything? to make it download the new file as opposed to spitting it out in a response object?
I then attempted to do the following:
CT.postSynch('report/payRollReport/createPayrollReport', {data : data}, function(data){
location.href='data:application/csv;charset=UTF-8,' + encodeURIComponent(data);
});
But what I am downloading is not a CSV its just a "download" as chrome calls is