Is there any way using chrome dev tools to find where an http request (ajax) was made?
I have a large project with many requests happening in different files. There's a particular request that I want to be able to inspect, I've found it on the Network tab, but there doesn't seem to be any way to find where in the code was this request started.
Javascript – find where in the code an http request was made using chrome dev tools
google-chromegoogle-chrome-devtoolsjavascript
Related Topic
- Google-chrome – Automatically open Chrome developer tools when new tab/new window is opened
- Google-chrome – Making HTTP Requests using Chrome Developer tools
- Google-chrome – Chrome Dev Tools: How to trace network for a link that opens a new tab
- Ios – UISegmentedControl in the Navigation Bar with the Back button
- JQuery DataTables mRender – how to get the row ID
- Rest – What’s the difference between “Request Payload” vs “Form Data” as seen in Chrome dev tools Network tab
- Javascript – How to find what code is run by a button or element in Chrome using Developer Tools
- R – How to give blackberry application all the available permission
Best Answer
Use the Initiator column in the Network panel. Clicking on the link in the Initiator cell takes you to the line of code where the request was made.
If you can't see it, right-click on the table header and select Initiator.
You can also hold Shift while hovering over a resource to see it's initiator. The initiator is green. Dependencies are red. If you can't see the initiator, then it's not currently visible on the table (could be higher up, filtered out, etc.)
MacPrawn's XHR Breakpoint idea is a good approach, too.