PHP File Download using POST data via jQuery AJAX

后端 未结 2 1328
伪装坚强ぢ
伪装坚强ぢ 2020-12-11 04:02

So I know there have been a number of similar posts, but I think this is enough of a variation to warrant its own question:

I am building an XLS exporter in PHP and

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-11 04:34

    It is possible to POST to a hidden iframe. Therefore, you don't need to worry about the length of the query string; you will post the key/value pairs which will generate your XLS file and subsequently force the file download to the browser.

    UPDATE A quick Google search turned up this article: http://particletree.com/notebook/ajax-file-download-or-not/

    Basically, the suggestion is to POST your form to the current page and respond with a file download. This alternative might be good enough for you.

提交回复
热议问题