I'm setting up some htm开发者_Python百科l exporting to excel and is doing this via jquery $.post. The result is data
$.post('/exportToExcel.php', function(data) {
// data is the file i want to download now... how to trigger it?
});
data is the returned value (the file) from the server, simply doing alert(data) will output a bigger window full of lol. how to i trigger so the file is able to be download?
You cannot do that using Ajax. Load the file in an iframe, and send this HTTP header with the file:
Content-Disposition: attachment
精彩评论