中止ajax调用javascript

I use the code below from one Stackoverflow answer to abort AJAX call in JavaScript/jQuery.

$.xhrPool.abortAll = function () {
  // alert('aborting.... outside');

  $(this).each(function (idx, jqXHR) {
    //jqXHR.abort();

    if (jqXHR && jqXHR.readyState != 4) {
        alert('aborting.... outside');
        jqXHR.abort();
    }
  });
  $.xhrPool.length = 0

  clearTimeout(timeoutOfCall);
  timeoutOfCall = null;
};

But, when I call this function like this :

$.xhrPool.abortAll();

it generate error in "unknown property" in IE 9 and also not working in Chrome. It is only working in FF.

查看全部
weixin_33729196
weixin_33729196
2012/10/17 10:07
  • call
  • abort
  • ajax
  • javascript
  • jquery
  • 点赞
  • 收藏
  • 回答
    私信

1个回复