Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I cancel an Ajax request? [duplicate]

In phonegap how to cancel an ajax request in program, I would like to set cancel button for control the request when it's too slow

$.ajax({
    type: "GET",
    url: url,
    success: function(m) {
        alert( "success");
    }
});
like image 795
oops Avatar asked Apr 29 '14 11:04

oops


1 Answers

hi it's similar as Abort Ajax requests using jQuery,anyway This can help you

 var ab = $.ajax({  type: "GET",  url: url,  success: function(m)  {    alert( "success");  } });

//kill the request
ab.abort()
like image 63
LeNI Avatar answered Sep 24 '22 17:09

LeNI