0

I'm using jquery 1.7.2 for some ajax call onloud of an aspx page. ajax calls webservice methods . if user push refresh button or click on some menu to redirect to another page when ajax calls still in progress and not success yet, an error shown in firebug console that not make sense. what can i do to kill ajax pending requests when user try to leave the page?

  • surely you will find your answer here: http://stackoverflow.com/questions/446594/kill-ajax-requests-using-javascript-using-jquery – Ashwini Verma May 17 '12 at 05:57

1 Answers1

-1

you can do this for instance it your ajax calling function

var call = $.ajax({
    type: "POST",
    url: "mywebservice.aspx",
    data: "some data you are passing ",
    success: function(msg){
      // do stuff on sucess
    }
});

and the you can call this to kill the process.

call.abort()
COLD TOLD
  • 13,513
  • 3
  • 35
  • 52