1, here to bulk deletion function as an example
function Datadel () {
var obj = document.getelementsbyname (' Duoxuan ');
var _list = {}; The key here is that the AJAX passed in the parameter is it
for (var i=0; i<obj.length; i++) {
if (obj[i].checked) {
_list["selectedids[" + i + "]"] = Obj[i].value;
}
}
$.ajax ({
Type: ' POST ',
URL: ' Admin/delmany ',
Data:_list,
DataType: ' JSON ',
Success:function (data) {
if (data) {
Alert ("Bulk Delete succeeded! ");
Location.reload ();
}
},
Error:function (data) {
Console.log (data);
},
});
}
2, PHP part, sent over the array all deposited in $_post[' Selectedids ']
Public Function Delmany () {
Articles::d Estroy ($_post[' selectedids ');
$result = Array (' status ' =>1);
echo Json_encode ($result);
}
Is Jiangzi, welcome you to add Oh ~ ~
Ajax methods for passing arrays into the background