I have an iframe on my page, and inside that iframe I execute code:
$.ajax({
url: '/SamplePage/ExportToExcel',
async: false,
data: par,
type: 'POST'
});
Response is returned fine, however I don’t get ‘SAVE ATTACHMENT’ dialog, nothing happens… To make things clear, headers are fine (content disposition, mime type etc,), as when I execute that export using plain form submission it works. It seems that it has something to do with ajax call. Will it work somehow?
Thanks
You won’t get the Save As dialog when using AJAX. If you want to get this dialog simply provide a normal link to the download file:
or if you need a POST request:
When you use AJAX to download a file the contents of this file is retrieved at the success callback but there’s not much you can do with it: you cannot save it to the client computer and you cannot get Save As dialog.