如何使用Jquery ajax读取yahoo weather JSON数据
||
http://weather.yahooapis.com/forecastjson?w=2295424
{
\"units\":
{\"temperature\":\"F\",\"speed\":\"mph\",\"distance\":\"mi\",\"pressure\":\"in\"},
\"location\":{\"location_id\":\"INXX0075\",\"city\":\"Madras\",\"state_abbreviation\":\"*\",\"country_abbreviation\":\"IN\",\"elevation\":49,\"latitude\":13,\"longitude\":80.18000000000001},
\"wind\":{\"speed\":12.00000000000000,\"direction\":\"E\"},
\"atmosphere\":{\"humidity\":\"23\",\"visibility\":\"4.35\",\"pressure\":\"29.77\",\"rising\":\"steady\"},
\"url\":\"http:\\/\\/weather.yahoo.com\\/forecast\\/INXX0075.html\",\"logo\":\"http:\\/\\/l.yimg.com\\/a\\/i\\/us\\/nt\\/ma\\/ma_nws-we_1.gif\",\"astronomy\":{\"sunrise\":\"06:20\",\"sunset\":\"18:19\"},\"condition\":{\"text\":\"Sunny\",\"code\":\"32\",\"image\":\"http:\\/\\/l.yimg.com\\/a\\/i\\/us\\/we\\/52\\/32.gif\",\"temperature\":93.00000000000000},
\"forecast\":[{
\"day\":\"Today\",\"condition\":\"Mostly Clear\",\"high_temperature\":\"91\",\"low_temperature\":\"69\"},{\"day\":\"Tomorrow\",\"condition\":\"Partly Cloudy\",\"high_temperature\":\"90\",\"low_temperature\":\"70\"}
]}
我要显示“预测”
没有找到相关结果
已邀请:
2 个回复
抹持奠糙驰
在data.forecast [0] .day中,用所需的任何属性替换\“ day \”。
攫怂绵十
我尝试过自己,但是使用jQuery 1.5时收到一个解析错误:我不知道为什么,代码应该可以。 马济