Possibly before $ .post and get the file upload dialog back

I am using jquery $ .post and was wondering if I can use this to return a FileResult? Did not have time? Content is returned in callback but not as file upload?

Thanks, rodchar

+2


a source to share


2 answers


It's impossible.



Instead, you can send a regular one <form>

with Javascript that responds Content-Disposition: attachment

.

+2


a source


I don't think this is possible using pure Ajax. You will need to redirect the browser to the file share somehow. (See my final starting point for a possible exception to this rule.)

What can you do:



  • Get the url of the file and redirect it in the callback success

    :location.href='...'

  • Return the url of the file and set it as src

    newly created iframe

    (to prevent the current page from closing / freezing)$("#iframe").attr("src", "....");

  • Maybe - I haven't used it myself yet, but it looks like it can do it - get the data and do a local file download using Doug Neiner Downloadify

+1


a source







All Articles