0

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

Community
  • 1
  • 1
  • Could you use jQuery and try adding a function call to `$.ajaxStart()`? http://api.jquery.com/ajaxStart/ – Jason Towne Jun 06 '12 at 15:58
  • I tried that and $.ajaxsetup and dont work since they didnt use jquery to call it? not sure but didnt work –  Jun 06 '12 at 16:00
  • This question seems similar. Have you tried wiring up the `ajaxStart()` method like this? http://stackoverflow.com/questions/1430438/how-to-call-jquery-ajaxstart-ajaxcomplete – Jason Towne Jun 06 '12 at 16:01
  • I think I would need to know where the actual code it being used and in my case its all js no jquery which is why this is becoming a task for me –  Jun 06 '12 at 16:04
  • where is the existed code that actually makes the ajax code? – AHMED EL-HAROUNY Jun 06 '12 at 16:05
  • in one of the hundreds of js files pulled. –  Jun 06 '12 at 16:09
  • @delboud Ok, now I understand your issue. I would recommend downloading and trying Fiddler. It doesn't matter what browser you're using with Fiddler. – Jason Towne Jun 06 '12 at 16:20
  • @JasonTowne great, now this is where my lack of ajax comes in... where can I locate the request? –  Jun 06 '12 at 17:21
  • 1
    @delboud, http://www.fiddler2.com/Fiddler/help/ The Fiddler documentation section is a good place to get started using the tool. Basically you're looking for requests to your Default.aspx page. It might make it easier to debug if you moved the web method to a separate file (assuming you're making the request from Default.aspx as well). – Jason Towne Jun 06 '12 at 17:34

1 Answers1

2

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

  • 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 –  Jun 06 '12 at 16:03