0 votes
1 view
in Web Technology by (47.8k points)

Using jQuery, how can I cancel/abort an Ajax request that I have not yet received the response from?

1 Answer

0 votes
by (107k points)

If you want to abort Ajax requests using jQuery then you can just use abort().

See the code below:-

var xhr = $.ajax({ 

type: "POST", 

url: "some.php", 

data: "name=John&location=Boston",

success: function(msg){ 

alert( "Data Saved: " + msg ); 

  } 

}); 

xhr.abort()

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...