首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Ajax >

jquery 获取jason的有关问题

2013-11-11 
jquery 获取jason的问题本帖最后由 jellday 于 2013-11-07 18:24:31 编辑{results : [{address_compone

jquery 获取jason的问题
本帖最后由 jellday 于 2013-11-07 18:24:31 编辑


{
   "results" : [
      {
         "address_components" : [
            {
               "long_name" : "LS2",
               "short_name" : "LS2",
               "types" : [ "postal_code_prefix", "postal_code" ]
            },
            {
               "long_name" : "Leeds",
               "short_name" : "Leeds",
               "types" : [ "locality", "political" ]
            },
            {
               "long_name" : "West Yorkshire",
               "short_name" : "West York",
               "types" : [ "administrative_area_level_2", "political" ]
            },
            {
               "long_name" : "United Kingdom",
               "short_name" : "GB",
               "types" : [ "country", "political" ]
            },
            {
               "long_name" : "Leeds",
               "short_name" : "Leeds",
               "types" : [ "postal_town" ]
            }
         ],
         "formatted_address" : "Leeds, West Yorkshire LS2, UK",
         "geometry" : {
            "bounds" : {
               "northeast" : {
                  "lat" : 53.8127,
                  "lng" : -1.5303786
               },
               "southwest" : {
                  "lat" : 53.7936373,
                  "lng" : -1.5654246
               }
            },
            "location" : {
               "lat" : 53.8055355,
               "lng" : -1.5551816
            },
            "location_type" : "APPROXIMATE",
            "viewport" : {
               "northeast" : {
                  "lat" : 53.8127,
                  "lng" : -1.5303786
               },
               "southwest" : {
                  "lat" : 53.7936373,


                  "lng" : -1.5654246
               }
            }
         },
         "types" : [ "postal_code_prefix", "postal_code" ]
      }
   ],
   "status" : "OK"
}




$.getJSON('http://maps.googleapis.com/maps/api/geocode/json?address=ls22nd&sensor=false',function(data){
alert(data.status);
});


请问怎么才能获取到"United Kingdom" 这个值?
[解决办法]
data.results[0].address_components[3].long_name

热点排行