Skip to content

Instantly share code, notes, and snippets.

@kylerush
Created March 5, 2014 04:53
Show Gist options
  • Select an option

  • Save kylerush/9361429 to your computer and use it in GitHub Desktop.

Select an option

Save kylerush/9361429 to your computer and use it in GitHub Desktop.
jQuery.get('/account/info').always(function(data, textStatus, jqXHR){
if(jqXHR.status === 200){
try{
jQuery('#user-name').text(data.userName);
} catch(error){
//handle the error, update the DOM to inform user the api is down
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment