Someone who goes by user FrenchToast on freenode pointed out a problem he was having using Backbone and the request data being modified before it was posted. He didn't have time to post here so I offered to forward it along.
Simply adding { jsonp: false } to Backbone's default ajax params is enough to fix the issue, but is this expected behavior in jQuery? I looked over the ajax and specifically jsonp related tests and only found tests exercising this feature on requests where the dataType was "jsonp".
I'm using the jquery-ujs library with a Rails 3 project. Forms with a data-remote attribute get converted into an ajax request using ajax(). In jQuery's internals, the response from the server is passed to parseJSON() which, if the body is a whitespace only string, will raise a parser error. Rendering a response with `head(:ok)` will return a body containing only a single space and thus cause an error.
I don't have any trouble making the fix with tests and submitting a pull request, but I'd like to get an opinion on if this is a jQuery bug or a jquery-ujs bug. It's fixable in jquery-ujs by adding a dataFilter callback and calling trim() on the response, but my personal opinion is this may be better handled by jQuery since I imagine this issue isn't only limited to Rails. Especially since parseJSON() already calls trim() on the input right after the check for a null or empty string.