Bug Tracker

Ticket #4897 (closed enhancement: fixed)

Opened 5 years ago

Last modified 3 years ago

REST-style JSONP callback option

Reported by: dandv Owned by:
Priority: high Milestone: 1.5
Component: ajax Version: 1.3.2
Keywords: ajaxrewrite Cc:
Blocking: Blocked by:

Description

I'm trying to get cross-domain JSONP data from this API:  http://judstephenson.com/programming/2008/11/realtime-stock-quotes-api-updated

Unfortunately, the API is not standard in accepting a ?callback=foo parameter, but rather requires appending 'foo' to the URL:

 http://judstephenson.com/api/Quotes/Realtime/aapl/json/foo

I've tried to use jquery.getJSON, but the way of specifying a callback is restricted to the "url?callback=?" scheme. I would need just "url/?".

Proposal: to accommodate REST APIs, if the URL ends in '/?', getJSON should simply replace the '?' with the callback name.

Change History

comment:1 Changed 5 years ago by jaubourg

You might wanna give jquery-jsonp a try:  http://code.google.com/p/jquery-jsonp/

Check the TipsAndTricks wiki page especially.

comment:2 Changed 4 years ago by dmethvin

  • Status changed from new to open

comment:3 Changed 4 years ago by dmethvin

  • Milestone changed from 1.4 to 1.5

comment:4 Changed 4 years ago by rwaldron

  • Keywords ajaxrewrite added

comment:5 Changed 4 years ago by jaubourg

  • Status changed from open to closed
  • Resolution set to fixed

Fixes #4897. Added ?? as a context-insensitive placeholder for the callback name of a JSONP request. Unit tests provided.

Changeset: 0c51e9d55f39366cab14719b80cb7e989c716351

comment:6 Changed 4 years ago by john

  • Priority changed from major to high
Note: See TracTickets for help on using tickets.