Skip to content

Instantly share code, notes, and snippets.

@erinlin
Created December 24, 2012 09:34
Show Gist options
  • Save erinlin/4368572 to your computer and use it in GitHub Desktop.
Save erinlin/4368572 to your computer and use it in GitHub Desktop.
Titanium-SSL httpClient
var login = function(args){
xhr.open( 'GET', args.url );
xhr.setRequestHeader('Accept', 'application/json');
xhr.setRequestHeader('Content-Type', 'application/json');
//TODO
var txt = Ti.Utils.base64encode( args.username + ':' + args.password).getText();
xhr.setRequestHeader('Authorization','Basic '+ txt);
xhr.onload = function(){
//TODO
}
xhr.onerror = function(){
Ti.API.info('error:' + this.responseText);
}
xhr.send();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment