#12326 closed bug (invalid)
$.AJAX changed the post content if include "??" (2 Question mark)
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | None |
Component: | unfiled | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Version: 1.7.1/1.8.0
$.ajax({ url: '/', dataType: 'json', data: '??', type: 'post', success: function(data){ }, error: function(XMLHttpRequest, textStatus, errorThrown){ } });
Please note that the post data including ?? (2 Question marks). It seems jquery change ?? as "jQuery1710291590959013191_1345184415274" (I think it is a callback name) before post to server.
The ?? was replaced on 7981th line of jquery-1.8.0.js
more information :
browser : firefox 14.0.1
OS : win7(nothing is related to OS)
THANK YOU
Change History (5)
comment:1 follow-up: 2 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
comment:2 Changed 10 years ago by
Replying to jaubourg:
- if your data is not supposed to be URL encoded, set the contentType option accordingly (for instance
"application/json"
) see http://api.jquery.com/jQuery.ajax/
We are setting the content type to "application/json; charset=utf-8" and the data is still being mangled:
var form = new Object(); form.p_id = '??'; $.ajax({ type: 'POST', url: ..., data: JSON.stringify( form ), processData: false, success: ..., error: ..., dataType: 'json', contentType: "application/json; charset=utf-8" });
comment:4 Changed 9 years ago by
I've found the same thing as [email protected] above. The contentType work-around described in the bug does not work. Specifically:
if your data is not supposed to be URL encoded, set the contentType option accordingly (for instance "application/json") see http://api.jquery.com/jQuery.ajax/
That has no effect, and the ?? still causes the request to scramble the data.
The other work-around cannot be used for JSON:
URL encode your data first using encodeURIComponent (as you should by default)
So this ticket is still valid and unresolved.
Thank you.
comment:5 Changed 9 years ago by
Yeah, I have to agree. Neither of those work arounds actually work correctly. If I wanted to have JSONP I would specify JSONP. Quick mucking with my data.
??
is used as the callback name placeholder in thedata
forjsonp
requests. So, finding it, jQuery will "promote" your request asjsonp
.Two solutions here:
"application/json"
) see http://api.jquery.com/jQuery.ajax/