0

How to stop all ajax process in the page using jQuery ?

faressoft
  • 19,053
  • 44
  • 104
  • 146

3 Answers3

1

The way to kill a single AJAX process is this way

var x = $.ajax({
    type: "POST",
    url: "some.php",
    data: "name=John&location=Boston",
    success: function(msg){
        alert( "Data Saved: " + msg );
    }
});

//kill the request
x.abort()

After you declare 'x' and initialize the ajax, simply add x to an array. Then you can cycle through the array and call each items .abort() method.

Dutchie432
  • 28,798
  • 20
  • 92
  • 109
0

You can save the reference and fire

ajaxid.abort();
j0k
  • 22,600
  • 28
  • 79
  • 90
Anooj
  • 286
  • 3
  • 13
0

You can for a process as follows. event.stopPropagation();

alfonsoolavarria
  • 1,141
  • 11
  • 11