开发者

jQuery ajax call to httphandler returning zip file

开发者 https://www.devze.com 2023-01-15 08:53 出处:网络
I have an httphandler that creates a zip file and returns it for download. context.Response.Appe开发者_运维技巧ndHeader(\"content-disposition\", \"attachment; filename=myfile.zip\");

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

context.Response.Appe开发者_运维技巧ndHeader("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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消