加载csv文件到jQuery? [英] Loading csv file into jQuery?

查看:184
本文介绍了加载csv文件到jQuery?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个CSV文件,我想用作jQuery flot图的源数据。



应该:


  1. 找到一个可加载CSV文件的jQuery插件


  2. ol>

    我没有太多运气找到一个jQuery插件可以处理外部CSV文件,但也许我错过了一些东西。

    解决方案

    使用jQuery CSV插件获取数组。



    jQuery CSV插件



    它刚刚发生,我可能会想到用jQuery读取一个平面的CSV文件。这是不可能的。让javascript访问文件系统听起来像一个可怕的想法。但您可以始终使用 $。get()在服务器上加载文件。


    I have a CSV file that I would like to use as source data for a jQuery flot graph.

    Should I:

    1. Find a jQuery plugin that will load the CSV file directly?
    2. Convert the CSV file into JSON and use that instead?
    3. Do something completely different?

    I'm not having much luck finding a jQuery plugin that can cope with an external CSV file, but maybe I'm missing something.

    解决方案

    Use the jQuery CSV plugin to get an array. Build / sort the array however you need for the chart.

    jQuery CSV Plugin

    It just occured to me you may be thinking of reading a flat CSV file with jQuery. That's not possible. Giving javascript access to the filesystem sounds like a terrible idea. You can always use $.get() to load a file on a server, though.

    这篇关于加载csv文件到jQuery?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆