I am posting some data on the server using jquery AJAX. The server exits a file (if the request is successful) I am just thinking how to start the file dialog within the given successful callback of the results? Thank you.
PS:
The simplest solution is:
$ ('# ExportToExcel'). Click (function () {$ ('entre ({verb:' bla}}; $ ('# form.') Submit (); return false;});
this is save the file dialog in your position, yes, the combination of JavaScript, server response and the browser By handling that reaction. Here's how:
- Create
post as a form of data on the server. - Create
iframe hidden with a unique name - Set the form
Goal to be the name of the iframe . - Send the form (e.g.,
formElement. Submit () ). - Answer your server to use the
content-disposition header with value attachments . For this, it is a suggestion , the result should be saved rather than appearing in the browser. If you really want to get fancy, you use I can describe the cookie moves so that they can receive a notification when the response is received (the server responds with the requested data or an error). I use very successfully in the browser-based DHML + Javascript application where the user can request custom PDF, and can choose to view it in the browser window (in this case my server includes a break in the content : Inline header) or save it as a file ( content-deviation: attachment ).
Comments
Post a Comment