我有一个有几个选择的表格。我有一个 js 函数,当被调用时,它会构建一个二维数组,其中包含选择 id 和其中的选定值:
function sendQueryPredicates(){
priorID = null;
id = null;
var predArray = new Array();
$("select option:selected").each(function () { // finds all selected options from all selects
id = $(this).parent().attr("id");
if(id != priorID){
//make a new subarray
predArray[id] = new Array();
i = 0;
}
text = $(this).text();
predArray[id][i] = text;
priorID = $(this).parent().attr("id");
i++;
});
$.getJSON("ajaxJQ_server.php", // server page called by jquery
{ // Data sent via ajaxJQ
"callingForm": "queryForm",
"callingElementID" : "jQquery_btn",
"callingState": "query",
"thisPasses": predArray['cageType'][0],
"thisDoesntPass": predArray
},
submitMouseQueryCallBck //function executed after return from ajax/jquery call to server
);
}
当我$_GET
在服务器上检查数组时,"thisDoesntPass": predArray
丢失了,而"thisPasses": predArray['cageType'][0]
, 确实通过了。
我不能在这个方法中传递数组吗?任何想法将不胜感激。