Welcome to the new BenajaminBenesh.com

Welcome to the new BenjaminBenesh.com. Some things are still being worked on, so check back for more!

The site has been moved to a new platform. Wordpress was way too much for what is used here, so now it is running off static content generated by Sculpin. It is a PHP static content generator similar to many tools currently available using other languages.

Tags: features

Comments

Appcelerator: Working with JSON

While working with Appcelerator and viewing examples by others, I've noticed that many people seem to find the need to use an eval() statement when parsing their remote JSON data. It works, but it can be done without using the eval() function just to parse the JSON string data. Below is a very basic example showing the use of the parse function built into Titanium.

var loader = Titanium.Network.createHTTPClient();
loader.setTimeout(99000);
loader.open("GET","http://someplace.tld/json");

loader.onload = function(){
    data = JSON.parse(this.responseText);
    alert(data);
};

loader.onerror = function(){
  Titanium.UI.createAlertDialog({
    message:"An error has occured.\nPlease try again.",
    title:'Connection Error'
  }).show();
};

loader.send();

Tags: Android, appcelerator, apps, ios, javascript, titanium

Comments