0

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

faressoft
  • 18,165
  • 42
  • 99
  • 142

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,462
  • 20
  • 90
  • 109
0

You can save the reference and fire

ajaxid.abort();
j0k
  • 22,303
  • 28
  • 77
  • 86
Anooj
  • 276
  • 3
  • 12
0

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

alfonsoolavarria
  • 1,032
  • 10
  • 11