@Ajax.ActionLink("删除", "Delete", new {id = user.Id}, ajaxOption)
@{
var ajaxOption = new AjaxOptions()
{
OnSuccess = "DeleteSuccess",
OnFailure = "DeleteFailure",
Confirm = "确定要删除当前的记录吗?",
HttpMethod = "Post"
};
}
<script>
$('#CertificateNumber').focus(); function DeleteSuccess() {
alert('成功删除当前数据');
location.reload();
} function DeleteFailure(xhr) {
alert('删除数据发生错误,状态码为:' + xhr.status);
}
<script> [HttpPost]
public ActionResult Delete(UserModel user)
{
user.DeletedInfo = "删除人:" + LoginFactory.GetCurrentLoginUser().UserId + ";删除时间:" + DateTime.Now;
RequestHelper.PostT("api/RemoveUser", user);
return RedirectToAction("Index");
}