Вопрос

It is possible to get the place reference id from google places api?

So far this is what I'm doing:

var geocoder;  
var autocomplete;
var zipCode = $('.j-zipcode').val(); 

function initialize(newZipcode) {
geocoder = new google.maps.Geocoder();

if( newZipcode != undefined ) {
    zipCode = newZipcode;
}

geocoder.geocode({address:zipCode},
    function(results_array, status) { 
        lat = results_array[0].geometry.location.lat();
        lng = results_array[0].geometry.location.lng();

        var myLatlng = new google.maps.LatLng(lat, lng);
        autocomplete = new google.maps.places.Autocomplete(document.getElementById('autocomplete'));                    
    }
)
}   

Any help? :/

Это было полезно?

Решение

the way to do it is by doing:

google.maps.event.addListener

That was easy!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top