I'm not sure if I'm gettin it right but I just started to use this jQuery-CSV parser plugin. I wanted to parse CSV file I have stored locally and then, based on results I get from it, use either jQuery's or ajax's notation to get certain data out of urls I provide.
var $ = jQuery = require('jQuery')
require ('./jquery.csv.js')
var sample = './analytics.csv';
fs.readFile(sample, 'UTF-8', function(err, csv) {
$.csv.toObjects(csv, {}, function(err, data) {
for(var i=0, len=data.length; i<len; i++) {
var link = toLink(data[i].Page)
$.get( link, function(data){
data[i].Category = $('.category').get(0)
});
console.log(data[i])
}
});
});
I'm getting back an error:
$.get(link, function (data){
^
TypeError: $.get is not a function
at main (E:\Programowanie\lolStats\index.js:16:7)
at Object.<anonymous> (E:\Programowanie\lolStats\index.js:37:1)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
It seems to me like it's looking for get() function in the jquery.csv.js file instead of regular jquery module I've installed for this project. What would be the easiest way to make both .csv.functions and regular jquery ones work in a same file?