简体   繁体   中英

Completed event for Ajax calls?

Is there some event that fires when an ajax request is completed? Even if it's not standard, as long it works on Firefox or Google Chrome.

Note: I didn't start the request, "someone else" did. It is not using 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 . 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.

I know there is one event that check for DOM changes , that is not exactly what I need, but it is one workaround.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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