【发布时间】:2012-08-22 06:06:01
【问题描述】:
我正在尝试检索一些特定数据,使用 jQuery 检索 JSON 提要。
这就是我目前正在做的事情:
var url = 'https://api.wunderground.com/api/myapicode/conditions/forecast/q/Tokyo.json?callback=?';
$.getJSON(url, function(d){
var data = d['current_observation'];
console.dir(data['display_location']);
});
这样就成功返回控制台了:
city ==> "Tokyo"
country ==> "JP"
country_iso3166 ==> "JP"
elevation ==> "8.00000000"
full ==> "Tokyo, Japan"
latitude ==> "35.54999924"
etc...
但是,假设我只想获得“完整”名称。如果我尝试:
console.dir(data['display_location']['full']);
我最终得到了结果:There are no child objects
关于我在这里做错了什么有什么想法吗?
【问题讨论】:
标签: javascript json weather-api