0

OnBeginでしばらくAjax.ActionLinkの ajax リクエストの送信を停止し、確認アラートが true の場合はリクエストを続行する必要があります。以下のコードでは、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 に答える