Having problems getting the different arrays content from geocoder results.
item.formatted_address works but not item.address_components.locality?
geocoder.geocode( {'address': request.term }, function(results, status) {
response($.map(results, function(item) {
alert(item.formatted_address+" "+item.address_components.locality)
}
});
// the array returned is;
"results" : [
{
"address_components" : [
{
"long_name" : "London",
"short_name" : "London",
"types" : [ "locality", "political" ]
} ],
"formatted_address" : "Westminster, London, UK" // rest of array...
any help appreciated!
Dc
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…