我目前有一个 jQuery ajax 函数,它向我的服务器发布一个多维数组。
$.ajax({
type: "POST",
url: "Default.aspx/SaveQuoteProcesses",
data: "{'items':" + JSON.stringify(jaggedArray) + "}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (msg){
console.log('Success');
},
error: function (){
console.log('Fail');
}
});
这是我当前发布到服务器的数据集示例:
[
{"QpcOpsID":"22","QpcQitID":"63"},
{"QpcOpsID":"20","QpcQitID":"63"},
{"QpcOpsID":"26","QpcQitID":"63"},
{"QpcOpsID":26,"QpcQitID":"63","QpcPprID":6,"PprQuestion":"How many colors?","AnswerValue":"4"}
]
我现在需要在同一个 AJAX 请求中向服务器发送一个常规数组。
["22", "20", "26"]
如何在现有的 javascript 对象中包含这个新数组?