But we are going to commit with AJAJX similar to: Array (' id ' =>12,data = = Array (' A ' =>1, ' B ' =>2) '); When the data of a two-dimensional array, the direct AJAX submission background is not received, and requires special handling:
Only two-dimensional array data can be processed here, and multidimensional needs to be done in loops or recursively
function Serialize_data (obj) { var str = '; for (var i in obj) { if (typeof (Obj[i]) = = = "Object") {for (var s in Obj[i]) { str = str + i+ ' [' + S + '] ' + ' = ' + O Bj[i][s] + ' & '; } } else{ str = str + i + ' = ' + obj[i] + ' & '; } } return encodeURI (str);}
is actually a URL request similar to this:
http://192.168.0.63/index,php?id=12&data[a]=1&data[b]=2
When used for a request, you can actually use:
var str = uriencode (' id=12&data[a]=1&data[b]=2 ');
And then you can use STR to post or get the way it happens.
JS serialized array for AJAX submission data