Skip to content

Instantly share code, notes, and snippets.

@notbenh
Created December 23, 2011 20:29
Show Gist options
  • Save notbenh/1515279 to your computer and use it in GitHub Desktop.
Save notbenh/1515279 to your computer and use it in GitHub Desktop.
Attempting to use ajax return object to modify current object
Thing.user = new Object;
Thing.user.new = function(user){this.user = user; return this};
Thing.user._fetch_user_data = function(){
$.ajax({ url: '/api/' + this.user
, dataType: 'json'
, async:false
, success: function(data){ console.info(data); for(key in data) this.$key = data[key]; }
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment