Skip to content

Instantly share code, notes, and snippets.

@appcdr
Created August 29, 2011 16:32
Show Gist options
  • Save appcdr/1178777 to your computer and use it in GitHub Desktop.
Save appcdr/1178777 to your computer and use it in GitHub Desktop.
Appcelerator: HTTPClient snippet
var url = "https://www.appcelerator.com";
var xhr = Ti.Network.createHTTPClient({
onload: function(e) {
// this.responseText holds the raw text return of the message (used for JSON)
// this.responseXML holds any returned XML (used for SOAP web services)
// this.responseData holds any returned binary data
Ti.API.debug(this.responseText);
alert('success');
},
onerror: function(e) {
Ti.API.debug(e.error);
alert('error');
},
timeout:5000
});
xhr.open("GET", url);
xhr.send();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment