New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ajax always processes data for requests without entity body #3438
Comments
The real question is : what is the purpose of setting the The Conflating the |
I have a hard time imagining any plausible purpose for No matter what, though, it's clear that http://api.jquery.com/jQuery.ajax/ needs an update. |
I hear you but I simply can't agree with a change that will make the following code not work anymore : $.ajax( {
url: "http://my.domain/path/to/script",
data: "param1=value1¶m2=value2",
processData: false
} ); There are many situations where it's far simpler to serialize url parameters beforehand rather than construct a data structure for the sole purpose of accomodating jQuery's internal serialization (hence my example of an object with a custom I think there clearly is a problem with the documentation if it implies that BTW, As an aside, where and when |
Hi @jaubourg! Always glad to have you here.
We do want the data to be used. One of the use cases that precipitated the ticket was that someone wanted to serialize the data to JSON rather than form-encode it.
Ok, so a prefilter that might take If the If we're not making code changes I definitely think we need to make docs changes. I'm not sure I see a lot of utility in |
Hi @dmethvin! Always glad to argue on tickets ;) Please note Your "don't use this" recommandation is spot on. The only time you need it is when you provide The following would definitely make $.ajaxPrefilter( options => {
options.data = options.data || options.rawData;
} ); |
I'm creating this ticket based on the discussion in the gh-3409 PR from @Litor so we don't forget to review it.
With ajax requests using HTTP methods that do not have a request body, such as GET, any provided data is always processed and removed, even if the caller specified
processData: false
. This seems contrary to the documentation which says:This behavior was also present before 3.x so it's not any kind of recent regression, but it does seem like a bug. I suppose you could argue that "this processing can be circumvented" refers only to serializing objects but not to appending the data to the URL, but that interpretation doesn't make sense. Why would someone want😸
[object Object]
appended to their URL?If we didn't process
data
at all, it would be possible for abeforeSend
handler to take an object and stringify it to the URL as desired , something like this currently non-working example:http://jsbin.com/fucigaqure/edit?html,console
The text was updated successfully, but these errors were encountered: