How to Abort Ajax requests using jQuery
by THavamani[ Edit ] 2013-08-09 11:43:05
how can I cancel/abort an Ajax request ?
<i>Most of the jQuery Ajax methods return an XMLHttpRequest (or the equivalent) object, so you can just use abort().</i>
Example:
var xhr = $.ajax({
type: "POST",
url: "mani.php",
data: "name=John&location=Boston",
success: function(msg){
alert( "Data Saved: " + msg );
}
});
//kill the request
xhr.abort()