Created
September 28, 2014 15:55
-
-
Save maleficarum/dccf319762b22f83dfe1 to your computer and use it in GitHub Desktop.
Parse config fetching on appcelerator app
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 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