0

I need to stop sending ajax request of an Ajax.ActionLink for a while on OnBegin and continue the request if confirm alert is true. In below code i could abort ajax request, is there any way to resend it using its own methods.

beforeDelete: function (x, y) {
    x.abort();
    bootbox.confirm("Are you sure you want to delete this?", function (result) {
        if (result) { 
          //process again
        }
    });
}

Edit: I have achieved it, Thanks 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;
    }
}
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Dileep Paul
  • 167
  • 3
  • 17

1 Answers1

0

Ok... You could break up the code:

bootbox.confirm("Are you sure you want to delete this?", function (result) {
        if (result) { 
          //send ajax request from here
        }
    });
CKmum
  • 641
  • 6
  • 17