1. 监听HTTP请求发出的事件是: xhr.onloadstart

2. 监听HTTP请求结束的事件是: xhr.onloadend

xhr.onloadstart = function() {
    // ...
};

xhr.onloadend = function() {
    // ...
};

 

注意: onloadend 事件不管请求失败或成功, 只要xhr.readyState等于4时就会触发.

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
  • 2022-12-23
  • 2022-02-21
  • 2022-01-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-19
  • 2021-10-10
  • 2022-12-23
  • 2021-04-10
  • 2021-04-25
相关资源
相似解决方案