Ticket #6551 (closed bug: invalid)
jsonp without a defined callback name does not set the Accept headers properly
| Reported by: | joeshred | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.4.3 |
| Component: | ajax | Version: | 1.4.2 |
| Keywords: | ajax jsonp json | Cc: | |
| Blocking: | Blocked by: |
Description
Try using the $.getJSON(...) or $.ajax(... ,dataType: 'jsonp', ... ) without setting the callback=<x> (the <x> part), and the Accept Header is set to */*, instead of "application/json...".
Reproducable by this (Note that this serverside code does not yet handle the callback parameter, but am experimenting to allow cross domain script calls to our API).
This loads incorrect Accept Header (even though JQuery will generate a name for the callback method):
$.getJSON(" https://api.globalgiving.org/api/public/projectservice/themes?api_key=e10c5e8e-730f-41c0-9b07-0983c94160a4&callback=?",
function(data){ alert("The Data is:"+data);});
This loads correct Accept header (by defining "callback=foo")
$.getJSON(" https://api.globalgiving.org/api/public/projectservice/themes?api_key=e10c5e8e-730f-41c0-9b07-0983c94160a4&callback=foo",
function(data){ alert("The Data is:"+data);});
I have similar issues using the dataType: 'jsonp' and jsonpCallback: param's in the .ajax(...) call.
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
