Skip to content

Instantly share code, notes, and snippets.

@wanewang
Created March 25, 2012 17:05
Show Gist options
  • Save wanewang/2198318 to your computer and use it in GitHub Desktop.
Save wanewang/2198318 to your computer and use it in GitHub Desktop.
getdata
function(url, callback) {
var xhr = Ti.Network.createHTTPClient();
xhr.open('GET', url);
xhr.onload = function() {
var parsedData = JSON.parse(this.responseText);
callback(parsedData);
};
xhr.onerror = function(e) {
alert('something wrong')
}
xhr.send();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment