so I'm trying to pass a multidimensional array to an $.post ajax function but for some reason its not reading the array.
sections = [];
for (var i = 0; i < 2; i++) {
var array = new Array();
array['main'] = i;
var items = new Array();
for (var j = 0; j < 2; j++) {
var array2 = new Array();
array2['sub1'] = (j+i);
array2['sub2'] = (j*i);
items[j] = array2;
}
array['items'] = items;
sections[i] = array;
}
console.log(sections);
$.post("planners/save_sections?ajax=1", {sections: sections, id:id}, function(response) {});
So using firebug to debug and looking at the post data being pass through, it seems it reads the id variable but doesn't read the sections variable.
And from the php side I used print_r($_POST)
to see what is being received and it also seem to only read the id variable.
Is there a syntax issue here? or I'm missing something? thanks in advance