我是Javascript / jquery的新手。我正在编写一个解析CSV文件的简单js文件。
var jquery = require('jquery');
jquery.get('file.csv', function(data) {
alert(data); // this is a line
var tempArray = data.split(','); // array of data
for(var i = 0; i < tempArray.length; i++)
{
console.log(tempArray[i]); // probably index 1 is your IPv6 address.
}
});
当我运行上面的代码时,出现以下错误:
jquery.get('file.csv', function(data) {
^
TypeError: jquery.get is not a function
at Object.<anonymous> (/Users/ishabir1/Desktop/transloc/parser.js:3:8)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
[Finished in 0.1s with exit code 1]
有人可以请教吗?谢谢!
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句