2011-04-10 106 views
0

在谷歌地图geocoder api的版本2中,有一种方法 geocoder.getLocations提供了很多有关请求地址的信息,例如:country,street,zip code ,纬度,经度,等...找不到谷歌地图的国家代码api 3地理编码请求

好像方法是在V3 走了,我们需要遍历address_component

当我尝试这样做,我得到一个错误“j被定义不”的时候运行这个

$.each(results[0].address_component, function (index, value) { 
         alert(index + ': ' + value); 
        }); 

http://maps.googleapis.com/maps/api/geocode/xml?address=75001,france&sensor=false

我如何遍历adress_component或更好,但我怎么去 的adress_component->型国家 - >短名

感谢

回答

0

我发现如何遍历集合

$.each(results[0].address_components, function (index, value) { 
        $.each(value, function (index2, val) { 
         alert(index2 + ': ' + val); 
        }); 
       }); 

但有没有一种更快的jQuery方式来到达特定的物品而无需迭代? 我想到address_components类型'国家' 我想现在它是一个JQuery的问题

相关问题