Permalink
Show file tree
Hide file tree
6 comments
on commit
sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Added in support for $.ajax jsonpCallback (allowing you to specify th…
…e name of the callback method - and allowing you to avoid skipping the cache). Fixes #4206.
- Loading branch information
Showing
2 changed files
with
34 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fbc73d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deja-vu!
few hours ago I've added similar functionality into my fork:
http://github.com/darwin/jquery/commit/458958afa24edc1127618ef43784416ef787efd5
my solution is little more flexible, because it enables user to specify function for jsonp callback computation, the motivation is explained in the commit message
fbc73d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really not a fan of line 238 of ajax.js. If the function is already defined:
I think it would be better if the function was redefined no matter what. Seems like the best course of action as long as it is documented.
fbc73d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jaubourg: I don't think we should override people's global variables. I think we can safely assume that if someone is explicitly defining a callback name, and providing the callback itself, then they're handling the whole shebang. I will definitely make that clear in the docs.
fbc73d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeresig: I still don't agree. If someone wanted to take control of the whole process, then he would probably call$.getScript and not bother with $ .ajax. I'd much prefer a solution like the one I have in http://github.com/jaubourg/jquery/blob/master/src/transports/jsonp.js (line 49 to 72). I basically substitute the value but put it back and call it if it's a function.
fbc73d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeresig: beside, I suppose you're still deleting the function anyway?
fbc73d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @jaubourg. I've just run into the fact that it will never call complete & success. That's counter intuitive, definitely not documented, and a major inconvenience. I'm using jsonpCallback because I need the browser caching. To loose the callbacks seems a high price to pay.
The lack of documentation for that side effect is presumably a bug.