How to specify content-type and content-disposition with $.ajax() GET response

后端 未结 2 1512
孤城傲影
孤城傲影 2020-12-21 16:59

I would like to make an async GET request that returns back a document with MIME content type and cause it to bring the browser\'s \'Save\' dialog.

Previously, I us

2条回答
  •  无人及你
    2020-12-21 17:06

    There is no way I know of to get a true Ajax request to pop a save dialog up. This has nothing to do with the headers sent by the server.

    If you'd like to programatically pop a save dialog box, you can use jQuery to append a hidden iframe to the page with the URL as it's src. This should pop the dialog box as necessary.

提交回复
热议问题