Ajax: How to prevent jQuery from calling the success event after executing xmlHttpRequest.abort();

后端 未结 6 1225
一个人的身影
一个人的身影 2020-12-31 16:34

Using jQuery\'s $.ajax() function. Wherether the request has been purposely aborted, or if the server is down (not responding) it appears the same outcome happens;

6条回答
  •  死守一世寂寞
    2020-12-31 17:02

    When is abort called. I just tested in firebug console with the following

    var req = $.ajax({url:"localaddress", success:function(){alert("evil");}}); req.abort();
    

    ie abort right after the request, success isn't triggered.

提交回复
热议问题