BrunoLM
BrunoLM

Reputation: 100322

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.

Upvotes: 2

Views: 221

Answers (1)

worenga
worenga

Reputation: 5856

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

Upvotes: 1

Related Questions