user240993
user240993

Reputation:

Listen for ajax call to fire event

I working with a off-shelf solution where its a ton with a ton of code I really can't get into. I'm trying to fire an event once a ajax call is made (they did not use jquery! they did it manually)

I found this

yourXMLHTTPRequest.onreadystatechange = function () {
  if (this.readyState == 4) {
      doJQueryStuff();
  }
}

here: Using jQuery to listen for an AJAX load that is not loaded using jQuery.AJAX

Not sure how I go about finding the "yourXMLHTTPRequest" part (don't use ajax that much, let alone manually written)

This needs to be outside of where the code is written, also not sure where its coming from, just need to fire once its pulled.

EDIT: To clear it up, i need to find the request thats being made like in on the live site (like in firebug or chrome tools) if possible

Upvotes: 0

Views: 1206

Answers (1)

Thomas Brasington
Thomas Brasington

Reputation: 588

yourXMLHTTPRequest would be defined like this

var yourXMLHTTPRequest = new XMLHttpRequest();

Full documentation can be found here https://developer.mozilla.org/en/xmlhttprequest and here https://developer.mozilla.org/en/DOM/XMLHttpRequest/Using_XMLHttpRequest

Upvotes: 2

Related Questions