From http://developer.appcelerator.com/question/145460/retrieve-json-from-server-and-commonjs-module