Skip to content

Instantly share code, notes, and snippets.

@alexanderkustov
Created May 6, 2014 11:56
Show Gist options
  • Select an option

  • Save alexanderkustov/a2d72aa9e17d645e4ec1 to your computer and use it in GitHub Desktop.

Select an option

Save alexanderkustov/a2d72aa9e17d645e4ec1 to your computer and use it in GitHub Desktop.
function editProfile(e) {
var url = mainserver + "/users/"+Alloy.Globals.user_id+"/?format=json&auth_token=" + Alloy.Globals.auth_token ;
var client = Ti.Network.createHTTPClient({
onload : function(e) {
Ti.API.info("Received text: " + this.responseText);
alert('Profile updated!');
},
onerror : function(e) {
alert('Error updating profile: ' + e.code);
console.log(e);
},
timeout : 60 * 1000
});
var params = {
'name': $.name.value,
'email': $.email.value.toLowerCase(),
'short_description': $.short_description.value,
'password' : $.password.value ,
'password_confirmation' : $.password_confirmation.value
};
auth_token = null;
client.open("PUT", url);
client.send(params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment