I wonna download file using javascript or jquery. I have to send request using post, cause I am sending also some data for file generation.
Currently I have:
$.ajax(reportGenerateUrl + reportName,{
contentType : "application/pdf",
processData : false,
method : "POST",
headers : csrfHeaders(),
data: criteria,
success : function(data, status, jqHXR) {
alert('Report generated!');
},
error : function(jqXHR, textStatus, errorThrown, data) {
alert('Unable to get report!');
}
});
My server returns pdf file, but no download prompt. I am getting file ooutput in network page in chrome dev tools.
Can any one help?