[EDIT] I solved the problem using D3 , nevermind thank you!
So, I have a csv file that looks something like this, and I need to import the local csv file into client side javascript:
"L.Name", "F.Name", "Gender", "School Type", "Subjects" "Doe", "John", "M", "University", "Chem I, statistics, English, Anatomy" "Tan", "Betty", "F", "High School", "Algebra I, chem I, English 101" "Han", "Anna", "F", "University", "PHY 3, Calc 2, anatomy I, spanish 101" "Hawk", "Alan", "M", "University", "English 101, chem I"
I ultimately need to parse it and output something like:
Chem I: 3 (number of people taking each subject) Spanish 101: 1 Philosophy 204: 0
But for now, I'm stuck just importing it into javascript.
My current code is as follows:
<!DOCTYPE html> <html> <body> <h1>Title!</h1> <p>Please enter the subject(s) that you wish to search for:</p> <input id="numb" type="text"/> <button onclick="myFunction()">Click me to see! :) </button> <script> function myFunction() { var splitResearchArea = []; var textInput = document.getElementById('numb').value; var splitTextInput = textInput.split(","); for(var i =0; i<splitTextInput.length; i++) { var spltResearchArea = splitTextInput[i]; splitResearchArea.push(spltResearchArea); } }
I researched and found useful links to Stackoverflow, for example, and this , but I'm new to javascript, and I don't quite understand this. Should I use Ajax? FileReader? Jquery What are the benefits of using one over the other? And how would you implement this in code?
But yes, I'm just confused as I am very new to javascript, so any help in the right direction would be great. Thanks!!