1 @Ajax.ActionLink("删除", "Delete", new {id = user.Id}, ajaxOption)
2 @{
3 var ajaxOption = new AjaxOptions()
4 {
5 OnSuccess = "DeleteSuccess",
6 OnFailure = "DeleteFailure",
7 Confirm = "确定要删除当前的记录吗?",
8 HttpMethod = "Post"
9 };
10 }
11 <script>
12 $('#CertificateNumber').focus();
13
14 function DeleteSuccess() {
15 alert('成功删除当前数据');
16 location.reload();
17 }
18
19 function DeleteFailure(xhr) {
20 alert('删除数据发生错误,状态码为:' + xhr.status);
21 }
22 <script>
23
24 [HttpPost]
25 public ActionResult Delete(UserModel user)
26 {
27 user.DeletedInfo = "删除人:" + LoginFactory.GetCurrentLoginUser().UserId + ";删除时间:" + DateTime.Now;
28 RequestHelper.PostT("api/RemoveUser", user);
29 return RedirectToAction("Index");
30 }