我需要停止在 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;
}
}
答案 0 :(得分:0)
好的......你可以分解代码:
bootbox.confirm("Are you sure you want to delete this?", function (result) {
if (result) {
//send ajax request from here
}
});