简体   繁体   English

Ajax通话已完成的活动?

[英]Completed event for Ajax calls?

Is there some event that fires when an ajax request is completed? 一个ajax请求完成时是否会触发某些事件? Even if it's not standard, as long it works on Firefox or Google Chrome. 即使它不是标准的,只要它在Firefox或Google Chrome上也可以使用。

Note: I didn't start the request, "someone else" did. 注意:我没有开始请求,“其他人”则开始了。 It is not using jQuery. 它不使用jQuery。


The reason I want this is because websites like facebook aren't updating the whole page, so it doesn't fire the window.onload . 我想要这个的原因是因为Facebook之类的网站不会更新整个页面,因此不会触发window.onload This is becoming an issue to develop addons. 这已成为开发插件的问题。 It is hard to check the page and inject the script. 很难检查页面并注入脚本。 If there were some event like window.onajaxcompleted it would be easier to inject the scripts. 如果发生诸如window.onajaxcompleted之类的事件,则注入脚本会更容易。

I know there is one event that check for DOM changes , that is not exactly what I need, but it is one workaround. 我知道有一个事件可以检查DOM的变化 ,这并不是我所需要的,但这只是一种解决方法。

  xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
     alert('Success');
    }
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM