Created
October 19, 2010 04:21
-
-
Save meltingice/633597 to your computer and use it in GitHub Desktop.
An example of how JSONP-Fu works.
This file contains hidden or 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
/* | |
* In order to include libraries, we need to know | |
* the absolute path to the jsonp-fu directory. | |
* | |
* BTW, jfu is a shortcut to jsonpfu that is defined | |
* as a part of the library. | |
*/ | |
jfu.set_path('/path/to/jsonp-fu/'); | |
/* | |
* Loads the TwitPic API plugin so that we can make | |
* calls against the TwitPic API. | |
*/ | |
jfu.load('twitpic', {}); | |
/* | |
* Since loading JS can take time, we use a ready() | |
* function very similar to jQuery's to register a | |
* callback that will fire when the TwitPic API | |
* plugin is ready for action. | |
*/ | |
jfu.ready('twitpic', function () { | |
jfu.lib('twitpic').users.show({username: 'meltingice'}, function (user) { | |
console.log(user); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment