I am trying to go through all over highchart
serieses and at the same time perform ajax to the server. Let's see the code below
var url = './sheet';
for(var k = 0; k < chart.series.length; k++) {
console.log(chart.series[k]);
$.getJSON(url).done(function (data){
if (data.length) {
console.log(chart.series[k]);
}
});
}
I am not sure what is the problem with the code above. As you can see the reference to var k
is lost when jQuery.getJSON
is done. Appreciate if you can help me. Thank you