Skip to content

Instantly share code, notes, and snippets.

@meltingice
Created October 19, 2010 04:21
Show Gist options
  • Save meltingice/633597 to your computer and use it in GitHub Desktop.
Save meltingice/633597 to your computer and use it in GitHub Desktop.
An example of how JSONP-Fu works.
/*
* 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