Skip to content

Instantly share code, notes, and snippets.

@benmcnelly
Created October 13, 2011 21:49
Show Gist options
  • Save benmcnelly/1285636 to your computer and use it in GitHub Desktop.
Save benmcnelly/1285636 to your computer and use it in GitHub Desktop.
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');
var win = Titanium.UI.createWindow({
title:'Places',
backgroundColor:'#333'
});
// Create XHR and load data
var xhr = Ti.Network.createHTTPClient();
var data;
xhr.open('GET', 'http://native.getdrinkvip.com/places/by_region/622/',false);
xhr.send();
xhr.onload = function() {
data = eval('('+this.responseText+')');
}
var tableview = Titanium.UI.createTableView({
data:data
});
//test alert
var x = Titanium.UI.createAlertDialog({
title:'Alert Test',
message:this.responseText
});
win.add(tableview);
win.open();
x.show();
@rmoe
Copy link

rmoe commented Oct 13, 2011

xhr.onload = function() {
alert(this.responseText);
//data = eval('('+this.responseText+')');
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment