Skip to content

Instantly share code, notes, and snippets.

@kavitshah8
Last active August 29, 2015 14:23
Show Gist options
  • Save kavitshah8/d3ef9263a58d1a7295cc to your computer and use it in GitHub Desktop.
Save kavitshah8/d3ef9263a58d1a7295cc to your computer and use it in GitHub Desktop.
Callbacks
function coordinates(x, y, callback) {
callback(x, y);
}
coordinates(10, 20, function(x, y){
console.log(x + y);
});
jQuery = {
get: function(url, params, callback) {
// DO XHR
if(response.status === 200) {
callback(response.data);
}
}
};
jQuery.get('/get/food', 'token:pizzahut', function(data) {
return data;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment