Exercise Three: Looping through data to create a simple bar chart.
We loaded up our Columbia Public Schools JSON in class Tuesday and iterated through the rows using a "for loop." We touched on three main concepts:
- Loading data via JQuery's super simple ajax method, $.getJSON:
$.getJSON("js/filename.json", function(data) {
doSomething(data);
})
-
Passed the data between functions. (See Paramaters and Arguments)
-
We looped through our data, and appended some markup to the page to create a simple bar chart. Some references you might find useful: