When you’re doing anything that involves sending and receiving information between a browser and server — particularly when you’re using XMLHTTPRequest (‘Ajax’) methods — it’s often useful to be able to look at (and even alter) exactly what’s being sent and received. As luck would have it, there are utilities available that make this very easy.
For Microsoft Internet Explorer users, there’s the unfortunately-named Fiddler (more info here), which integrates into IE, intercepts all requests and allows you to alter any headers and parameters before the request is sent. It then shows the details of the response(s) received. You can even have Fiddler stop before returning the response to the browser, so that you can edit the response content before continuing.
If you’re using Mozilla Firefox, you could look at an extension called Tamper Data. It’s rather limited compared to Fiddler — you can’t view or edit the raw response data, for example — but it is simpler and integrates seamlessly.
However since Fiddler is in some ways more powerful than Tamper Data, you might want to use it in Firefox too. You can do this by configuring Fiddler as a proxy. It’s easy enough to do so — details are on this page, under ‘How can I configure other browsers to use Fiddler?’. To make life even easier, I’ve installed the ProxyButton extension which allows me to enable/disable Fiddler as a proxy with a single button-click.
I find this sort of utility especially useful when it comes to testing security: playing around with data submitted through forms is one of the most popular (and simple) ways to attack a web site. With these tools you can test that corrupt data will not compromise your site.