I want to be able to call a URL be either a standard HTTP GET, or an AJAX call.
The server needs to handle the request slightly differently based on whether the request was an AJAX request or not.
Using jQuery, I want to automatically add a parameter to all AJAX requests I make, so that the server can identify them, and without me having to add the parameter everywhere I make a call.
I've tried doing this with a jQuery.ajaxSend event handler, but at that point, the XMLHttpRequest is already constructed, and making changes to the URL or data members of the ajaxOptions object has no effect, and I don't know how to reliably manipulate the XMLHttpRequest object (I can examine it in Firebug, but I don't know what I can expect work in a cross-browser manner).
How should I achieve this? Is there a better way to identify AJAX requests?