Jquery cancel ajax request

Asked

Viewed 205 times

3

How can I cancelar uma solicitação do Ajax that has not yet received the answer using Jquery.

1 answer

5


You can use the method abort(), example:

var xhr = $.ajax({
    type: "POST",
    url: "pagina.php",
    success: function(msg){
      ...
    }
});

//aborta o request
xhr.abort();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.