I have setup the jQuery plugin WhatWeather and its working fine but have a little problem.
When i get the weather data i get this txt file.
{ "data": { "current_condition": [ {"cloudcover": "100", "humidity": "100", "localObsDateTime": "2013-12-08 02:23 PM", "observation_time": "01:23 PM", "precipMM": "4.3", "pressure": "1008", "temp_C": "7", "temp_F": "45", "visibility": "7", "weatherCode": "296", "weatherDesc": [ {"value": "Light rain" } .....] }}
To get data showed on my page i use "currentCondition.cloudcover" and then i get the cloudcover 100, but i can't get the weather description i have tried "currentCondition.weatherDesc" and then i get the output "Object : Object". and not "Light rain" how do I get the value "Light Rain" from the txt file ?
wheatherDesc
is an array of an object itself so try currentCondition.weatherDesc[0].value
So overall:
data.current_condition[0].weatherDesc[0].value
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.