I need from Google Place Autocomplete these values:
alert(
  place.name +                       // Works
  place.geometry.location.lat() +    // Works
  place.country +  // Not works - what is correct value to get country value?
  place.state      // Not works - what is correct value to get state value?
  );
It works for place.name and place.geometry, but it not works for place.country and place.state.
How to get also the other two values? Thank you for any advice.
Whole function:
function initializeGoogleMaps() {
    var input = document.getElementById("googleMapsSearch");
    var autocomplete = new google.maps.places.Autocomplete(input);
     google.maps.event.addListener(
        autocomplete,
        "place_changed",
        function() {
        var place = autocomplete.getPlace();
        alert(
          place.name +                       // Works
          place.geometry.location.lat() +    // Works
          place.country +  // Not works - what is correct value to get country value?
          place.state      // Not works - what is correct value to get state value?
        );
        document.getElementById("city").value = place.name;   // Works
        document.getElementById("cityLat").value = place.geometry.location.lat();   // Works
        document.getElementById("country").value = place.country;   // Not works
        document.getElementById("state").value = place.state;   // Not works
     });
}
				
                        
You can get the state and the country under the
address_componentsarray returned by thegetDetails()method. Since the address components is being returned as an array, you can parse the results like this:Note:
administrative_area_level_1usually signifies to thestateand varies depending on the political heirarchy of a certain country.Here's a complete sample you can refer to. You just need to replace "YOUR_API_KEY" with your own API key.
For more information regarding Place details results, please checkout this link: https://developers.google.com/maps/documentation/javascript/places#place_details_results
Hope this helps!