Capture, Intercept, Log, Monitor, Network, Record, Sniff, Traffic
Diagnose problems by sniffing ??? traffic. Many Ajax problems arise because ??? messages are either wrong or not sent at all. Debugging and general logging on either side of the network might help you infer what's being transmitted, but it's better to grab the traffic directly. There are various ways to do this:
In the browser, use “XMLHttpRequest Call”s in a wrapper that logs the request and response (see “Logging”). This may be the most convenient technique, because the programmer's probably already looking at the browser. The downside is you'll miss out on non- ??? traffic, e.g. full page refreshes.
Employ a generic network traffic monitor, filtering on HTTP traffic to and from the server.
Configure your browser to use a generic HTTP proxy, and have the proxy log interesting traffic in either direction.
In the server, intercept incoming and outgoing traffic for logging. Server-side frameworks often have a common controller object which can be instrumented to capture information in either direction. In addition, interception facilities are often available, such as Java's Servlet Filters.
Traffic Sniffing is a kind of “Logging” function. As such, you'll probably want similar filtering functionality, e.g. to see only messages in one direction, matching certain text, or to a particular URL.
Adam Vandenberg has noted that his personal flangelib.js library contains an XMLHttpRequest wrapper to log traffic. While you're unlikely to use flangelib, it's mentioned here because some XMLHttpRequest wrapper libraries may eventually implement “Logging” functionality. The main barrier right now is the lack of an industry-standard logging library.
http://blog.monstuff.com/XmlHttpRequestTracing:  intercepted open (GET , patternList.phtml , true , undefined , undefined) http://blog.monstuff.com/XmlHttpRequestTracing:  intercepted send (null)
Then, the result, showing response code (200) and content:
http://blog.monstuff.com/XmlHttpRequestTracing:  intercepted load: 200 Ajax Stub|||Browser-Side Cache|||Browser-Side Templating|||Browser-Side XSLT||| ....