๐:0
The done
method of getJSON will wait until the promise is complete, then add the data to your list.
$(function(){
var url = "anekal.json";
$.getJSON(url).done(function(data){
$.each(data, function(i,f){
l.push(f.Percentage_Completed);
m.push(f.Mentor_Name);
})
}); // end of getJSON
}); // end of function
EDIT: The problem happens because you iterate over each property of the data, not the data itself. Changing $.each(data.Percentage_Completed, function(i,f){
to $.each(data, function(i,f){
and then l.push(f);
to l.push(f.Percentage_Completed);
seems to fill up the array.