This is an old question, but I came here from Google and thought other people searching the same thing should have a working solution. I have tried the suggested answer but it does not work. Modifying the data in ajaxSend handler does not change what is being sent.
My objective was the same as OP's, insert an additional parameter into the requests.
So I devised a hacky solution for it: override jQuery's ajax method.
Just replace "injected_param" and "injected_value" to suit your needs. I've added some guards to check whether the parameter is already present or not, just in case.
$(function() {
var jqAjax = $.ajax;
$.ajax = function (settings, settingsObj) {
if (typeof(settings) == "string") {
settingsObj.url = settings;
settings = settingsObj;
}
if (!settings.data) {
settings.data = {};
}
if (typeof(settings.data) == "string" && settings.data.indexOf("&injected_param=") < 0) {
settings.data += "&injected_param=injected_value";
}
else if (!settings.data.injected_param) {
settings.data.injected_param = "injected_value";
}
jqAjax (settings);
};
});