Skip to content

Instantly share code, notes, and snippets.

@maleficarum
Created September 28, 2014 15:55
Show Gist options
  • Save maleficarum/dccf319762b22f83dfe1 to your computer and use it in GitHub Desktop.
Save maleficarum/dccf319762b22f83dfe1 to your computer and use it in GitHub Desktop.
Parse config fetching on appcelerator app
var parseURL = "https://api.parse.com/1/config";
var xhr = Ti.Network.createHTTPClient({
onload: function(e) {
//Ti.API.info(this.responseText);
//alert('success');
var response = JSON.parse(this.responseText);
response = response.params;
Ti.API.info(response);
alert('success');
},
onerror: function(e) {
Ti.API.info(" ERROR " + this.responseText + " -- " +e);
//alert('Error Getting Key Values');
},
timeout:10000 /* in milliseconds */
});
xhr.open("GET", parseURL);
xhr.setRequestHeader('X-Parse-Application-Id', "APPID");
xhr.setRequestHeader('X-Parse-REST-API-Key', "APIKEY");
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(null);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment