My JSON data:
[{"day0":"0","day1":"0","day2":"2","day3":"1","day4":"1"}]
I have tried this and it works for me:
var Respuesta=jQuery.parseJSON(JSON);
data.setValue(0, 1,Respuesta[0].day0);
data.setValue(1, 1,Respuesta[0].day1);
data.setValue(2, 1,Respuesta[0].day2);
data.setValue(3, 1,Respuesta[0].day3);
data.setValue(4, 1,Respuesta[0].day4);
but I need to do it on loop
var column = ["day0", "day1", "day2", "day3", "day4", "day5", "day5", "day6", "day7", "day8", "day9", "day10", "day11", "day12", "day13", "day14", "day15"];
for (i = 0; i < 5; i++) {
data.setValue(i, 1,Respuesta[0].column[i]);
}
I think I have a problem on this column[i]
. Please could you help me with that?