【发布时间】:2015-06-04 13:34:58
【问题描述】:
我需要在 OnBegin 上停止发送 Ajax.ActionLink 的 ajax 请求一段时间,如果确认警报为真,则 继续 请求.在下面的代码中,我可以中止 ajax 请求,有没有办法使用自己的方法重新发送它。
beforeDelete: function (x, y) {
x.abort();
bootbox.confirm("Are you sure you want to delete this?", function (result) {
if (result) {
//process again
}
});
}
编辑: 我已经实现了,谢谢 Guruprasad。
var prevDel = true;
function beforeDelete(x, y) {
if (prevDel) {
x.abort();
bootbox.confirm("Are you sure you want to delete this?", function (result) {
if (result) {
prevDel = false;
$.ajax(y);
} else {
prevDel = true;
}
});
} else {
prevDel = true;
}
}
【问题讨论】:
-
this link 可能会对您有所帮助
标签: asp.net-mvc alert actionlink bootbox unobtrusive-ajax