216

In Firefox, I use Firebug which allows me to view every http request my ajax calls are making. I've switched over my development to Chrome and am liking it so far. My only complaint, however, is that the developer tools don't seem to allow you to view each ajax request. I've had it happen once where the Resources panel showed multiple requests to the same resource, but it's only done it once and never again.

Is there a way to reliably see every http request that a page is making through javascript from within Chrome?

[Edit:11/30/09 11:55]

Currently, to get around this, I'm running Fiddler next to Chrome to view my requests, but if there's a way to do it from within the browser, I'd prefer that.

Wes P
  • 9,102
  • 14
  • 39
  • 48
  • 2
    I have the same problem -have tried all the solutions here. Nothing appears in the Response part of the XHR window in the dev tools. It just shows "This request has no response data available". If i run the same code using firebug, it shows up fine. in the cog dev tools settings, I have tried ticking "Log XMLHttpRequest" but this didnt help (response type is application/json). I have to do all debugging in firebug. Firebug also formats the JSON nicely, chrome dev tools doesnt if you can get it to display the response (e.g. by not using ajax). – John Little Jun 12 '13 at 12:09

9 Answers9

368

I know this is an old thread but I thought I would chime in.

Chrome currently has a solution built in.

  1. Use CTRL+SHIFT+I (or navigate to Current Page Control > Developer > Developer Tools. In the newer versions of Chrome, click the Wrench icon > Tools > Developer Tools.) to enable the Developer Tools.
  2. From within the developer tools click on the Network button. If it isn't already, enable it for the session or always.
  3. Click the "XHR" sub-button.
  4. Initiate an AJAX call.
  5. You will see items begin to show up in the left column under "Resources".
  6. Click the resource and there are 2 tabs showing the headers and return content.
maheshwaghmare
  • 1,462
  • 15
  • 22
Phil
  • 3,829
  • 1
  • 14
  • 7
  • 2
    Thanks Phil! I had put this aside and been relying mostly on Fiddler. But that XHR button is what I was looking for :D – Wes P Jun 11 '10 at 19:10
  • just yesterday i was talking that if chrome tools could do this it would be perfect, thank you. – Germán Rodríguez Sep 06 '11 at 14:38
  • In case someone else does this: I had clicked on the "Name" column to sort it earlier and forgot then, later, some new requests would jump to the middle of the list due to alphabetical sorting. I had to refresh the page to unsort. – Curtis Yallop Jan 08 '14 at 17:57
  • 3
    Hi all, tryin to find the "XHR sub-button" I think I may be missing it, can someone tell me where that is? this is what my inspector looks like http://imgur.com/9e6yDcB – David Williams Jan 27 '14 at 17:33
  • @DavidWilliams click on the small lamp which will open a menu bellow http://screencast.com/t/DY9pgTSU4zx – lackovic10 Jul 09 '14 at 10:50
  • Also in the "Network" tab on chrome you can monitor requests and view POST request parameters there as well. – Jason C Jul 09 '14 at 20:50
  • 2
    This seems to only happen if an AJAX call gets a response, but it doesn't show you an outgoing request that might not expect a response. Anybody know how to enable that? – MoMo Jul 28 '14 at 19:19
  • @MoMo - At first I agreed with you, but then I realized that doesn't seem to be the case. If the request doesn't get a response, you will still see it with a status of 404. – TTT Mar 04 '16 at 19:44
  • Spent 2 days to identify the culprit. Your answer helped me to find out in the easier way...thanks buddy :) – Shilpa Soni Mar 08 '16 at 05:56
  • too bad the network tab doesn't persist... if the page redirects you're out of luck. the console says there was a XHR request... but there's no request/response payload or headers in the console. – Brad Kent Oct 18 '16 at 20:58
  • 1
    If the page redirects on the same window you can use the 'Preserve Log' checkbox at the top of the network tab options (if not you can change that link to open in the same window by setting `target='_self'` ). Then, for example, you can see the response from the form that got submitted after it redirects you. Make sure to also notice the filter as the responses pile up on new page loads. – JeremyS Jan 17 '17 at 19:25
  • @DavidWilliams The XHR "sub button" is under Filters. It's one of the Filters. XHR requests already appear in the Network tab, they're just among all of the other calls. – M. Herold Aug 10 '17 at 19:28
  • Also, if you're trying to search for a URI, under Network > View you'll want to toggle off "Use small request rows". Small request rows don't include the URI, so they're not searchable. – M. Herold Aug 10 '17 at 19:30
57

The most up-to-date answer to this is: they are listed under the 'Network' button in the developer tools, no longer under 'Resources' like it used to be.

Wouter
  • 723
  • 5
  • 5
  • 5
    That is indeed where it is now, took me searching stack overflow to find it after upgrading. – Kzqai Apr 01 '11 at 20:00
43

Update

Chrome changed how to inspect requests and suggests now to use the Catapult Netlog Viewer with the logs exported from chrome://net-export/

chrome://net-export/

More Info

Old Chrome Versions

You also may use this link in Chrome for more detailed information than the inspector did it.

chrome://net-internals/#events

This shows the log of all requests of the browser while open

Karl Adler
  • 12,243
  • 9
  • 55
  • 77
14

don't know as of which chrome version this is available, but i found a setting 'Console - Log XMLHttpRequests' (clicking on the icon in the bottom right corner of developer tools in chrome on mac)

schellmax
  • 5,011
  • 2
  • 35
  • 47
6

Open up your DevTools and press F1 to access the settings. Look for the console section and check the checkbox for "Log XMLHttpRequests".

Now all of your ajax and other similar requests will be logged in the console.

I prefer this method because it usually allows me to see everything that I'm looking for in the console without having to go to the network tab.

ShaneDaugherty
  • 373
  • 3
  • 6
4

You could use Fiddler which is a good free tool.

JoshBerke
  • 62,464
  • 23
  • 120
  • 162
  • 1
    Yea, I have Fiddler which is what I'm using to do this. Just looking for a way to do it from within the browser, as it's a bit more convenient. – Wes P Nov 30 '09 at 16:55
3

Thanks all person who try to help in this post

I have ubuntu 13.10 and my chrome version is 34.0

For my situation this works

1.open developer tools in chrome(or use right click on your page and then select inspect element)
2.go to "Network" tab
3.find your ajax request in "Name Path" column 
4.click on the specific ajax link

now you should see a new Panel in front of you request

in this panel select "Response" tab
masoud2011
  • 716
  • 7
  • 8
1

In the step 5 of Phil, "Resources" is no longer available in the new version of the Chrome. You need to click the page icon just beside the Ajax page listed in the bottom pane with the columns of Name, Method, Status, ...

Then it will show you more panels where you will find the error messages.

wcb1
  • 537
  • 1
  • 6
  • 6
0

You can also just right click on the page in the browser and select "Inspect Element" to bring up the developer tools.

https://developer.chrome.com/devtools

BitByteDog
  • 2,080
  • 2
  • 21
  • 32