JQuery确认插件自动提交

时间:2014-08-14 13:08:02

标签: jquery asp.net-mvc

您好我有一个jQuery确认脚本,我在foreach循环中只有一个标准按钮

@Html.ActionLink(" ", "Delete", new { id = item.Id }, new { @Class = "btn-group btn btn-danger glyphicon glyphicon-remove complexConfirm" })

$(".confirmDelete").confirm({
title: "Delete confirmation",
text:  "Would you like to continue to delete this record? You will not be able to revert back if you confirm on the next page.",
confirmButton: "Yes",
cancelButton: "No",
});

上面的代码是工作点,它做了它的意思,点击按钮弹出你确定,点击是它进入页面,点击不关闭。 我想要它做的是,如果我点击是,我希望它在_Delete页面上提交jQuery,所以基本上他们点击删除按钮,然后点击是然后它将自动提交删除页面表单,然后再次重定向到索引

1 个答案:

答案 0 :(得分:0)

修复了我所要做的就是添加post:true到现在的jquery:

$(".confirmDelete").confirm({
title: "Delete confirmation",
text:  "Would you like to continue to delete this record? You will not be able to revert back if you confirm on the next page.",
confirmButton: "Yes",
cancelButton: "No",
post:true

如文档中所示,帖子在这里做了什么:

  

post:如果为false(默认值)且未设置确认处理程序,则重定向   用户到具有GET请求的按钮/链接的URL。如果是真的,   使用POST请求重定向(如表单提交)。