简体   繁体   中英

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

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

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