开发者

How to download csv file using jquery?

开发者 https://www.devze.com 2023-01-06 07:04 出处:网络
How to download csv file using jquery ? I have group of records开发者_StackOverflow中文版 into jquery , so i need to export to csv and download using jquery .

How to download csv file using jquery ? I have group of records开发者_StackOverflow中文版 into jquery , so i need to export to csv and download using jquery .

Suggestions please..


OK, so there are (at least) three ways to download files:

  1. Build the file on the server, and set it to force download.
  2. Build the file on the client, and allow the user to download it via a special feature in Flash 10 without touching the server.
  3. Encode the info into a Data URI or use the IE specific variation to save a client side file. (This approach has a ton of limitations and issues)

Since you said you have the CSV in jQuery (I assume you mean JavaScript) here I would suggest you look into the library I wrote, Downloadify, for use in situations like this. The Demo page or documentation should be able to get you going.

Downloadify is a JavaScript interface for the Flash 10 feature. As with any technology, I suggest you also implement a variation fallback on the server for users w/o Flash 10.


jQuery cannot create a downloadable file. You need to do this server side. You can use a language like PHP or you can try putting jQuery on the server through one of the server side JS implementations.

0

精彩评论

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