jQuery.ajax: Document special handling of a double question mark#1171
Merged
mgol merged 2 commits intojquery:masterfrom Aug 24, 2020
Merged
jQuery.ajax: Document special handling of a double question mark#1171mgol merged 2 commits intojquery:masterfrom
mgol merged 2 commits intojquery:masterfrom
Conversation
Member
Author
|
BTW, is it just the double question mark? Isn't the single one replaced as well? |
Member
Author
|
From the code it seems that /(=)\?(?=&|$)|\?\?/See the visualization at: |
mgol
commented
Jul 22, 2020
entries/jQuery.ajax.xml
Outdated
| <desc> | ||
| <p>Data to be sent to the server. If the HTTP method is one that cannot have an entity body, such as GET, the <code>data</code> is appended to the URL.</p> | ||
| <p>When <code>data</code> is an object, jQuery generates the data string from the object's key/value pairs unless the <code>processData</code> option is set to <code>false</code>. For example, <code>{ a: "bc", d: "e,f" }</code> is converted to the string <code>"a=bc&d=e%2Cf"</code>. If the value is an array, jQuery serializes multiple values with same key based on the value of the <code>traditional</code> setting (described below). For example, <code>{ a: [1,2] }</code> becomes the string <code>"a%5B%5D=1&a%5B%5D=2"</code> with the default <code>traditional: false</code> setting.</p> | ||
| <p>When <code>data</code> is passed as a string it should <strong>already be encoded</strong> using the correct encoding for <code>contentType</code>, which by default is <code>application/x-www-form-urlencoded</code>. If the string contains a double question mark (<code>??</code>) it is replaced with a value generated by jQuery that is unique for each copy of the library on the page (e.g. <code>jQuery21406515378922229067_1479880736745</code>).</p> |
Member
Author
There was a problem hiding this comment.
We should document it only happens for dataType: "jsonp" or dataType: "json" and the latter will no longer trigger it in jQuery 4.0+.
Member
Author
|
We also need to take jquery/jquery#4754 into account - in jQuery 4 the logic will only be triggered for requests with |
timmywil
approved these changes
Aug 10, 2020
Fixes jquerygh-999 Ref jquerygh-1005 Co-authored-by: Dave Methvin <dave.methvin@gmail.com>
Member
Author
|
I created the issue for jQuery 4.0: #1176. |
0c831b9 to
493d13b
Compare
Member
Author
|
@timmywil I rebased the PR & added a new fixup commit with the changes from my comments. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This is the text provided by @dmethvin in #1005 (comment) that I formatted & split into 3 paragraphs.
Fixes gh-999
Ref gh-1005
Co-authored-by: Dave Methvin dave.methvin@gmail.com