如何使用Ajax调用获取CSV文件

时间:2014-10-30 13:56:32

标签: javascript jquery ajax csv

我有一个小的Ajax函数,假设它可以获取一个在线CSV文件,但它仍然会因此错误而失败:

NS_ERROR_FAILURE:
    request.send();                  csonv.js (line 101)

有问题的功能如下:

 var ajax = function(url) {
        request = new(window.ActiveXObject || XMLHttpRequest)("Microsoft.XMLHTTP");
        request.open("GET", url, 0);
        request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
        request.send();
        return request.responseText;

我正在尝试使用csonv.js从互联网上抓取CSV文件并将其转换为JSON。任何帮助表示赞赏。感谢。

0 个答案:

没有答案