Bug Tracker

Modify

Ticket #6551 (closed bug: invalid)

Opened 4 years ago

Last modified 2 years ago

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

comment:1 Changed 4 years ago by dmethvin

  • Component changed from unfiled to ajax

comment:2 Changed 4 years ago by bullman

Are the multiple "?" is the querystring the problem here?

comment:3 Changed 4 years ago by addyosmani

  • Priority set to undecided
  • Status changed from new to closed
  • Resolution set to invalid

Closing as the original ticket submitter has not responded to a request to clarify further information on the original bug in 2 months.

comment:4 Changed 3 years ago by jitter

#7694 is a duplicate of this ticket.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.