如何使用jQuery下载CSV文件? [英] How to download csv file using jquery?
问题描述
如何使用jquery下载csv文件?我将一组记录放入jquery中,因此我需要导出到csv并使用jquery下载.
How to download csv file using jquery ? I have group of records into jquery , so i need to export to csv and download using jquery .
请提出建议.
推荐答案
确定,因此(至少)有三种下载文件的方式:
OK, so there are (at least) three ways to download files:
- 在服务器上构建文件,并将其设置为强制下载.
- 在客户端上构建文件,并允许用户通过Flash 10中的特殊功能下载文件而无需接触服务器.
- 将信息编码为数据URI或使用IE特定版本来保存客户端文件. (这种方法有很多限制和问题)
由于您说过您在jQuery中拥有CSV(我假设您的意思是JavaScript),因此建议您查看我编写的库, Downloadify ,用于此类情况.演示页面或文档应该可以帮助您.
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是Flash 10功能的JavaScript界面.与任何技术一样,我建议您还为不使用Flash 10的用户在服务器上实施变体回退.
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下载CSV文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!