I've created a multidimensional array in js and I want to pass it to PHP through Ajax and have no clue how to so i'm looking for some direction
Array construction & Ajax call:
Array construction & Ajax call:
Code:
function save(numStd){
//Find Selected Class
var all = document.all ? document.all :
document.getElementsByTagName('*');
var elements = new Array();
for (var e = 0; e < all.length; e++)
if (all[e].className == 'active')
var currentClass=all[e].id;
var sendParams=encodeURIComponent(numStd)+"¶m1="+encodeURIComponent(currentClass);
//Declare array
var array = new Array(3);
for (var i = 0; i < numStd; i++) {
array[i] = ['', ' ', ' '];
}
//fill array
for (var j = 1; j <= numStd; j++) {
var ln = document.getElementById("LastName"+j).value;
var fn = document.getElementById("FirstName"+j).value;
var ag = document.getElementById("Age"+j).value;
var h=j-1;
array[h][0] = ln;
array[h][1] = fn;
array[h][2] = ag;
}
var urlNewStd = "/phpscripts/saveNewStd.php?param=";
http.open("GET", urlNewStd + escape(numStd)+"¶m1="+escape(currentClass)+XXX ARRAY HERE XXX, true);
document.getElementById("studentresult").innerHTML="<img src='/images/ajax-loader.gif' style='margin:50px 0 0 110px;'/>";
http.onreadystatechange = handleHttpResponseNewStd;
http.send(null);*/
}