jquery ajax 怎样向后台传递数组

2024-11-02 16:32:02
推荐回答(1个)
回答(1):

这里有一例供你参考:
var _list = {};

for (var i = 0; i < checkedRow.length; i++) {

_list["selectedIDs[" + i + "]"] = checkedRow[i].ID;

}

$.ajax({

url: '@Url.Action("SetCallBackStatus")',

//data: { "selectedIDs": _list },

data: _list,

dataType: "json",

type: "POST",

//traditional: true,

success: function (responseJSON) {

// your logic

alert('Ok');

}

});