title: JavaScript: Detect AJAX requests
body: <p>Is there any way to detect global AJAX calls (particularly responses) on a web page with generic JavaScript (not with frameworks)?</p>
  
  <p>I've already reviewed the question "<a href="https://stackoverflow.com/questions/3596583/javascript-detect-an-ajax-event">JavaScript detect an AJAX event</a>", here on StackOverflow, and tried patching in the accepted answer's code into my application but it didn't work. I've never done anything with AJAX before either so, I don't know enough to modify it to work.</p>
  
  <p>I don't need anything fancy, I just need to detect all (specific, actually, but I'd have to detect all first and go from there) AJAX responses and patch them into an IF statement for use. So, eventually, I'd like something like:</p>
  
  <pre><code>if (ajax.response == "certainResponseType"){
      //Code
  }
  </code></pre>
  
  <p>, for example.</p>
  
  <p><strong>Update:</strong>
  It seems I should clarify that I'm not trying to send a request - I'm developing a content script and I need to be able to <em>detect</em> the web page's AJAX requests (not make my own), so I can execute a function when a response is detected.</p>