Opened 14 years ago
Closed 13 years ago
#4206 closed enhancement (fixed)
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: |
Description
Say, your page requests http://ws.audioscrobbler.com/2.0/?method=user.getweeklyartistchart&user=...&format=json&callback=foo 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: 'http://ws.audioscrobbler.com/...&callback=?', success: ..., dataType: 'json', callbackName: 'AudioScrobblerChart' });
requests http://ws.audioscrobbler.com/...&callback=jsonpAudioScrobblerChart.
The patch throws an error if the programmer uses the same callbackName
twice simultaneously.
Attachments (1)
Change History (4)
Changed 14 years ago by
Attachment: | jquery-callbackname.diff added |
---|
comment:1 Changed 14 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:2 Changed 14 years ago by
Resolution: | wontfix |
---|---|
Status: | closed → reopened |
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.
comment:3 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
Version: | 1.3.2 → 1.4a1 |
It doesn't really seem like this is needed. If you're really worried about static naming you could just do:
...which isn't really a huge stretch.