开发者

JSONP / Export to Excel [closed]

开发者 https://www.devze.com 2023-04-06 04:35 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

We're using JSONP (cross-site request) request with JQuery to开发者_高级运维 retrieve data from our server; everything is fine.

But now we need to retrieve an Excel file; any idea / pointer on how to do that (we're using Firefox).

Thx.


You could setup a server side handler on the remote domain which will serve the Excel file and append the Content-Disposition: attachment; filename=foo.xlsx HTTP header so that the browser opens a Save As dialog. Now all that's left is provide the user with some link to download the file:

<a href="http://remotedomain.com/file">Download Excel file</a>

No javascript is required.

0

精彩评论

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