Skip to content

Instantly share code, notes, and snippets.

@kavitshah8
Last active August 29, 2015 14:24
Show Gist options
  • Save kavitshah8/3f349f1d76fcbfc4af5d to your computer and use it in GitHub Desktop.
Save kavitshah8/3f349f1d76fcbfc4af5d to your computer and use it in GitHub Desktop.
Callback
jQuery = {
get: function(url, callback) {
// do some XHR and get response back from the server
if (response.status === 200) {
callback(response.data);
}
}
}
var url = '/foo.com';
jQuery.get(url, function(data) {
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment