使用getJSON()传递数组

时间:2012-05-24 20:51:02

标签: jquery arrays getjson

我有一个有几个选择的表格。我有一个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],确实已通过。

我不能在这个方法中传递数组吗?任何想法都将不胜感激。

0 个答案:

没有答案