Skip to main content

Bug Tracker

Side navigation

#4206 closed enhancement (fixed)

Opened February 20, 2009 09:36PM UTC

Closed December 07, 2009 01:18AM UTC

Patch: JSONP: Support callbackName to request content with a constant URL

Reported by: ion Owned by:
Priority: minor Milestone: 1.4
Component: ajax Version: 1.4a1
Keywords: jsonp callback Cc:
Blocked by: Blocking:

Say, your page requests using JSONP. The response doesn’t change often and it isn’t urgent to get the most recent possible version.

Currently the callback name will be different for each request. If there were a way to keep the callback name constant for that specific request, both the browser and the server could cache the content.

The attached patch implements the callbackName parameter for $.ajax, so that

$.ajax ({
  url:          '',
  success:      ...,
  dataType:     'json',
  callbackName: 'AudioScrobblerChart'


The patch throws an error if the programmer uses the same callbackName twice simultaneously.

Attachments (1)
Change History (3)

Changed February 21, 2009 01:25AM UTC by john comment:1

resolution: → wontfix
status: newclosed

It doesn't really seem like this is needed. If you're really worried about static naming you could just do:

$.ajax ({
  url:          '',
  dataType:     'script'

function AudioScrobblerChart(json){
   // do stuff with the JSON

...which isn't really a huge stretch.

Changed August 26, 2009 08:44AM UTC by tudor_s comment:2

resolution: wontfix
status: closedreopened

I also came about making the same patch as posted here. It would really benefit caching by having this option. Especially when you want your other jQuery plugins to use the same settings without the need to change the way they request data.

Therefore this change would really be appreciated, especially when it comes with a small cost to implementing it.

Thank you.

Changed December 07, 2009 01:18AM UTC by john comment:3

resolution: → fixed
status: reopenedclosed