Skip to content

Instantly share code, notes, and snippets.

@mattyoho
Forked from trek/$.ajax_context.js
Created October 27, 2011 15:19
Show Gist options
  • Save mattyoho/1319857 to your computer and use it in GitHub Desktop.
Save mattyoho/1319857 to your computer and use it in GitHub Desktop.
person = {
save: function(){
$.ajax('...', {
context: this,
success: this.saved,
error: this.errored
})
},
saved: function(data){
console.log('OMG. USEFUL SCOPING.')
},
errored: function(resp){
console.log('error tears')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment