My situation is as follows: I have some Javascript code that I did not write myself, but I that I would like to get acquainted with (actually, I want to debug it). In particular, I am interested in what AJAX requests this code makes, and when.
This Javascript code I'm looking at is quite complex and lengthy and chaotic. So basically, just reading the source code or grepping the source code for this or that function call is not a good option. What I would like is some Firefox or Chromium plugin (whichever works) that does the following:
While loading the page and executing the Javascript, I would like it to catch any AJAX request that is made and tell me about it (most importantly, what URL is being called, though knowing what POST parameters etc. are travelling along that request would be useful as well). It would be awesome if it actually stopped before each execution of an AJAX request, told me about it, and asked me if it should proceed. But I would also be happy even if it did nothing else but simply print each URL that the Javascript sends an AJAX request to into a console or something.
Any suggestions?
You can do this in Chrome without needing any plugins, or in Firefox with the Firebug plugin:
side-note: when I say "XHR" I mean "XML / HTTP requests", which is what ajax requests fall under.
Just open your Dev Tools (F12), and go to the Network tab (second tab in Chrome 32). From the moment you open the tab on, all requests are logged there. Click the third icon at the top of the Network tab (says "filter" when hovering over it) and then select the "XHR" filter, which will limit it to just XHR.
You can also right click in your Console tab and select the "Log XMLHttpRequests" option, which will then log all XHR in your console too.
Open your Firebug, and open your Net tab (second last tab), and click "Enable" in it (default is disabled). From the moment you enable the tab on, all requests are logged there. At the top bar within that tab, you can click the button that says "XHR" to limit it to XHR only.
You will also by default see all XHR in your console in Firebug.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With