What's an easy way to see what AJAX calls are being made?

做~自己de王妃 提交于 2019-12-30 06:17:46

问题


I'm looking for something (preferably a Firefox extension) which will allow me to see all AJAX subrequests. Basically, anytime an XMLHTTPRequest() is made, I want to know what URL was being requested and what (if any) GET and POST vars were passed along with it.

Unless I'm missing it, I don't see anything quite like this in Firebug or Web Developer Toolbar.

(In case you're curious, the main reason for wanting this is that I want to scrape a local copy of a site that is using JS to load all its contents, and I don't want to spend hours digging through their JS code when I could just see the subrequests being made.)


回答1:


Firebug should show it in the Net panel.

EDIT: Also, if Firebug slows down your Firefox in a way that makes it unusable, like it does for me sometimes, WireShark (formerly Ethereal) will analyze all network traffic on your system, including HTTP and AJAX requests.




回答2:


Fiddler 2 is a great tool for watching HTTP traffic.

* 2014 Update *

Since my original post, both Internet Explorer and Chrome have added built-in developer tools that are quite useful. While I still support and use Fiddler for non-web related http monitoring or when I need to really dig in deep and modify requests in transit, these days I find myself pretty much using IE or Chrome's built in tools as they are sufficient for 99% of my needs. They both have a networking tab, where you can monitor http requests, plus other nifty features for debugging webpages.

  • Internet Explorer F12 Tools Introduction
  • Documentation for Chrome's F12 Tools
  • FireBug, which is mentioned above is also a good tool if you're using FireFox.



回答3:


I have used nearly all the big tools out there (fiddler, firebug, httpfox, live http headers). The best one in my opinion is HTTPFox if you are using Firefox because it has easy filtering capabilities, allows you to view your JSON the request/response as raw or formatted and the over all interface is very clean.

Also, I can't do without WFetch for testing web services and AJAX stuff. Usually I'll take the request from HTTPFox and paste it into WFetch. This way I don't have to go through the browser each time. I just hit F5 in WFetch to replay the request and I directly modify the request.

Side note: In WFetch, be careful about content-length if you have a POST payload. If you modify the payload the content-length needs to be changed as appropriate. For this reason I save my requests in a file and point WFetch to the file. In the file itself it is easy to know the length of the line and change content-length to that.


(source: koreus.com)

alt text http://www.port80software.com/assets/images/ld_wfetch3.gif




回答4:


Firebug shows them in both the Net panel, and the Console view. You need to turn on "Show XMLHttpRequests" though.




回答5:


Have a look at Tamper Data as well. It's a Firefox add-on that lets you have a look at each individual HTTP request (including any post data) and response, and the headers of both. I've found it very useful for debugging AJAX problems...although Firebug works just fine.



来源:https://stackoverflow.com/questions/911209/whats-an-easy-way-to-see-what-ajax-calls-are-being-made

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!