I have been starring at this for days now and do not understand why some items in the following function can not be retrieved.
Weatherforecastlist: function() {
var qItem ={};
var weatherforecastarray = [];
for (var i = 0; i < 12; i=i+2) {
qItem={
s7100: WTH.weatherforecast.forecast.txt_forecast.forecastday[i].title,
s7101: WTH.weatherforecast.forecast.txt_forecast.forecastday[i].icon_url,
s7102: WTH.weatherforecast.forecast.simpleforecast.forecastday[i].low.celsius + " °C",
s7103: WTH.weatherforecast.forecast.simpleforecast.forecastday[i].high.celsius,
s7104: WTH.weatherforecast.forecast.simpleforecast.forecastday[i].avewind.dir,
s7105: WTH.weatherforecast.forecast.simpleforecast.forecastday[i].avewind.kph + " kph",
s7106: WTH.weatherforecast.forecast.simpleforecast.forecastday[i].avehumidity + " %",
s7107: WTH.weatherforecast.forecast.simpleforecast.forecastday[i].qpf_day.mm + " mm", s7108: WTH.weatherforecast.forecast.txt_forecast.forecastday[i].fcttext_metric,
s7109: WTH.weatherforecast.forecast.simpleforecast.forecastday[i].conditions
};
weatherforecastarray.push(qItem);
};
CF.listRemove("l71");
CF.listAdd("l71", weatherforecastarray);
},
When I only try to load the items "txt_forecast" the information loads fine in the list. But the "simpleforecast" items generate an error:
SCRIPT: Exception: TypeError: 'undefined' is not an object (evaluating 'WTH.weatherforecast.forecast.simpleforecast.forecastday[i].low')
When display the object with CF.logObject (Thanks Jarrod..), I see the following, not sure this has something to do with it (just one line out of the log).
........low = object (increase log depth to see contents)
I have attached the JSON file I'm parsing.