Javascript 如何在yahoo weather';s地理数据节点?
我正在使用插件 它已经从yWeatherAPI中提取了大部分数据,但我需要纬度和经度 插件获取每个item元素的数据,例如:Javascript 如何在yahoo weather';s地理数据节点?,javascript,ajax,xml,latitude-longitude,yahoo-weather-api,Javascript,Ajax,Xml,Latitude Longitude,Yahoo Weather Api,我正在使用插件 它已经从yWeatherAPI中提取了大部分数据,但我需要纬度和经度 插件获取每个item元素的数据,例如: html += '<div class="weatherCountry">'+ feed.location.country +'</div>'; html+=''+feed.location.country+''; 然而,如果我尝试这个 html += '<div class="latitude">' + feed.item.geo
html += '<div class="weatherCountry">'+ feed.location.country +'</div>';
html+=''+feed.location.country+'';
然而,如果我尝试这个
html += '<div class="latitude">' + feed.item.geo.lat + '</div>';
html += '<div class="longitude">' + feed.item.geo.long + '</div>';
html+=''+feed.item.geo.lat+'';
html+=''+feed.item.geo.long+'';
…它无法获取这些元素的数据
我应该如何访问geo:lat
和geo:long
下面是一个实例:可以通过以下方式访问
geo:lat
和geo:long
的数据:
html += '<div class="latitude">' + feed.item.lat + '</div>';
html += '<div class="longitude">' + feed.item.long + '</div>';
html+=''+feed.item.lat+'';
html+=''+feed.item.long+'';
console.log()
feed.item.geo对象,查看它包含哪些数组项。它看起来不包括lat
和long
@Charlie-它看起来像是未定义的。但是当我记录feed.item对象时,它实际上包含lat和long值。你刚刚帮我弄明白了feed.item.lat
和feed.item.long
是我需要的。谢谢