Json – How to find out the piece of code that initiated ajax request


I have MVC view, in that tens of javascript files are included.
there are some ajax requests initiated from the page. I would like to know from which particular js file the call was initiated.

I spent some time exploring Firefox addons – Firebug and HttpFox. Both are showing the http request, header , cookies and other hell lot of information, but nothing about the source where the ajax request was initiated.

Best Solution

I've been finding some of Chromes more recent debugging features very useful. Bring up the inspector(Ctrl+Shift+I) and switch to the Network tab before launching your application or performing the actions in question. Each http request will show the origin of the request in the Initiator column. If javascript initiated the request, it will show you the filename and line number with a clickable link to go straight to it.