3
votes

I have an httphandler that creates a zip file and returns it for download.

context.Response.AppendHeader("content-disposition", "attachment; filename=myfile.zip");

Is it possible to call the handler from a jquery ajax call? If yes, what kind of dataType should I declare?

Thanks

1
What would you be doing with the result you receive? - Fosco
I want to manage errors status code in case the zip building fails, then from jquery I show a loading message while the httphandler builds the zip, so I would hide the loading message when ajax call ends and alert eventual erros. - opaera

1 Answers

1
votes

What I would suggest here is not to return the ZIP file through Ajax, but create it and return a link to it (or the error message). Then you can process the response and either show the error or allow the user to download from the link.