I cannot get ajaxSend (http://api.jquery.com/ajaxSend/) to properly modify the parameters to include a random timestamp and, for IE's sake, a _method=value pair. I have:
$(document).ajaxSend(function(event, request, settings) {
settings
.data = $.deparam(settings.data);
settings
.data['random'] = new Date().getTime();
settings
.data['_method'] = settings.type;
settings
.data = $.param(settings.data)
$
.log(settings);
});
$
(document).ready(function() {
//...snip...
$
.ajaxSetup({
data
: {
remote
: 1,
authenticity_token
: encodeURIComponent(AUTH_TOKEN)
}
});
});
The idea here is that we always want 4 param sent across: ajaxSetup sets 'remote' and 'auth_token' properly without fail. However, 'random' and '_method' (both needed for different IE issues) do not get set despite the "proof" I have from the log statement at the end of ajaxSend which shows me that they are set to settings.data:
"remote=1&authenticity_token=6GA9R_snip_253D&random=1270584905846&_method=get"
So it looks like settings.data has the _method and remote values, but when it gets sent across the wire, I only have the following:
authenticity_token 6GA9R_snip_253D
remote
1
So my questions is how can I make sure that what gets sent across the wire is the
value I set settings.data to in my ajaxSend() method?