0

我需要在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;
    }
}
4

1 回答 1

0

好的...您可以分解代码:

bootbox.confirm("Are you sure you want to delete this?", function (result) {
        if (result) { 
          //send ajax request from here
        }
    });
于 2015-06-04T13:40:01.033 回答