我正在尝试通过检查所有复选框值来删除所有记录。但它抛出 500 内部服务器错误。
//delete all menu
function performalldeletemenu()
{
if (confirm('Are you sure you want to delete this menu?'))
{
var AllCheckboxes = new Array();
$("input:checked").each(function () {
//console.log($(this).val()); //works fine
AllCheckboxes .push($(this).val());
});
$.ajax({
type: 'DELETE',
url: '/api/MenuWebApi/DeleteAllMenu/',
data: { deleteservice: AllCheckboxes },
success: function (data) {
if (data.Success == true) {
GetMenuList();
}
},
error: function (xhr, textStatus, errorThrown) {
//window.location = JsErrorAction;
},
dataType: "json",
headers:
{
'RequestVerificationToken': JsTokenHeaderValue
}
});
}
return false;
}
Web-Api 方法
public HttpResponseMessage DeleteAllMenu(MenuModel objMenuModel)
{
}
请如果以前做过,请告诉我。