我想删除已经检查过我不想使用post方法的html表上的多行。怎么能发送Id数组发送Controller.I我正在使用EF6 谢谢你的帮助。
$.ajax({
url: "/Urun/DeleteField" + '/' + DeleteArray,
type: "DELETE",
dataType: "JSON",
data: JSON.stringify(DeleteArray),
cache: false,
success: function(node) {
if (node.success) {
alert("İşlem Başarılı");
} else alert("İşlem Başarısız");
}
});
while (DeleteArray.length > 0) {
DeleteArray.pop();
}
答案 0 :(得分:0)
在服务器端:
[HttpDelete]
public JsonResult TestDelete(List<int> Ids)
{
//your businbes logic goes here
return Json(new { success = true}); //return example
}
在客户端:
var DeleteArray = [1, 2, 3, 4]; //your array example
$.ajax({
url: "@Url.Action("TestDelete","Home")", // create urls properly
type: "DELETE",
dataType: 'json',
contentType: "application/json, charset=utf-8",
data: JSON.stringify({ Ids: DeleteArray }),
cache: false,
success: function (node) {
if (node.success) {
alert("Success"); //your success callback logic goes here
} else alert("Fail");
}
});
答案 1 :(得分:0)
我在web.config中修改过这行...
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>`