Here's my relevant code:
var data_final = [];
for(var i = 1; i<4; i++) {
$.ajax({
...
},
crossDomain: true,
success: function(raw_data) {
// Put the data in the proper array
for(var d in raw_data.data) {
data_final[i-1].push([parseDate(d), raw_data.data[d]]);
}
data_final[i-1] = twoDimensionalSort(data_final[i-1]);
}
});
I get an error on this line: data_final[i-1].push([parseDate(d), raw_data.data[d]]);
that "Uncaught TypeError: Cannot read property 'push' of undefined".
Does the .push
method not allow one to push an array into an array? It works fine if I take out the [i-1]
specification in data_final
, but I need that to specify where the data should be pushed.