Address component type in google maps geocoding
- by user552828
this is a part of my geocoding code. I want it to show only country of the selected place, but it shows all address components, My problem is I cant specify the address components object. There is a way of doing it that is written on documentation but I didnt understand, can you do it for me.
if (geocoder) {
geocoder.geocode({'latLng': latlng}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var str = "";
$.each(results, function(){
str += "address components: <ul>"
$.each(this.address_components, function(){
str +="<li>"+this.types.join(", ")+": "+this.long_name+"</li>";
});
str +="</ul>";
});
$("#geocode_info").html(str);