I would like the function timeZoneFix to return the variable timeFromLocation. The data is stuck in timeZoneAPI(...){...}. I want to get it out to be able to use it. I couldn't figure it out how to do this thanks!
function timeZoneFix(lat,lng,time){
var locationInfo=[lat,lng,timeStamp/1000];
timeZoneAPI(locationInfo,function(result){
var timeFromLocation=[result.dstOffset,result.rawOffset];
});
}
var timeZoneAPI = function(locationInfo,callback) {
xhr = Titanium.Network.createHTTPClient();
var url = buildUrl(locationInfo);
xhr.open('GET', url);
xhr.onload = function() {
var result = JSON.parse(this.responseText);
callback(result);
};
xhr.send();
};