【发布时间】:2013-08-13 21:58:31
【问题描述】:
我正在尝试通过检查所有复选框值来删除所有记录。但它会引发 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)
{
}
如果之前有做过的请告诉我。
【问题讨论】:
标签: asp.net asp.net-mvc checkbox asp.net-web-api