Skip to content

Instantly share code, notes, and snippets.

@smsohan
Created July 28, 2012 18:58
Show Gist options
  • Save smsohan/3194417 to your computer and use it in GitHub Desktop.
Save smsohan/3194417 to your computer and use it in GitHub Desktop.
Sample API module
apiModule = {
get: function(url, callback, errorCallback) {
return $.ajax({
url: url,
success: function(response) {
if(isNewServerToken(response.server_token)){
reloadPage();
}
else{
return callback(response);
}
},
error: function(jqXHR, textStatus, errorThrown) {
return errorCallback();
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment