Or any other function to preprocess your data for that matter :)
Because of my server side framework, I always need to call JSON.stringify before sending my data - unnecessary boilerplate, that you can forget to add.
Right now I have:
$.ajax({
[...]
data: JSON.stringify({ someData: self.someData }),
[...]
});
I would prefer:
$.ajax({
[...]
data: { someData: self.someData },
[...]
});
I've looked into ajaxSetup, but can't find a solution for this, so far...
Update
For a reason why I need this, see the following this question. I could fix this on the serverside, but for now I'm looking for a way to fix this on the clientside.
responseType..if its got "text" or "html" this might happen$.ajaxSetup({ contentType: 'json' });$.param, thus turning it into serialized data such assomedata=foobar&someotherdata=barfoo