Modify ↓
Ticket #12326 (closed bug: invalid)
$.AJAX changed the post content if include "??" (2 Question mark)
| Reported by: | yehuicn@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | None |
| Component: | unfiled | Version: | 1.8.0 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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
comment:1 follow-up: ↓ 2 Changed 10 months ago by jaubourg
- Status changed from new to closed
- Resolution set to invalid
comment:2 in reply to: ↑ 1 Changed 8 months ago by doherty@…
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"
});
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

?? is used as the callback name placeholder in the data for jsonp requests. So, finding it, jQuery will "promote" your request as jsonp.
Two solutions here: