Created
August 29, 2011 16:32
-
-
Save appcdr/1178777 to your computer and use it in GitHub Desktop.
Appcelerator: HTTPClient snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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