I am trying to parse csv file to arrays using this jquery-csv plugin but when checking log for $.csv is says undefined. However, when I copy and execute the code from the plugin directly in the console, $.csv works. I even tried method jquery's getScript() method to import the jquery-csv directly to my custom script but it shows undefined.
$.getScript("../js/jquery-csv.js"); console.log($.csv);
Also tried added this in head and it shows up in Chrome developer tools
script(scr='https://cdnjs.cloudflare.com/ajax/libs/jquery-csv/0.8.9/jquery.csv.min.js') included this in the head of the page. It shows up in head through chrome devtools
P.S - Using pug template engine
You can not use direct $.csv
after run getScript
function. because maybe it take some time to load js but console.log
statement run after getScript
statment run . so you have to try this ..
$.getScript("../js/jquery-csv.js",function(){
console.log($.csv);
});