user3068929
user3068929

Reputation: 11

Google Map places API - search address by country and code postal

Please I want to use the autocomplete places API to get address based on country 'fr' and postal code like 87000

This is what I have done:

function initialize() 
{
   var quartier = document.getElementById('quartiers');

   var request = {
    types: ['geocode'], 
    componentRestrictions: {country: 'fr'}
   };

   var autocomplete = new google.maps.places.Autocomplete((quartier), request);

   google.maps.event.addListener(autocomplete, 'place_changed', function(data)
   {
      //some code here
   });
}

This one works great for country, but I don't know how to get it working with a specific postal code like 87000.

Any ideas?

Upvotes: 1

Views: 3150

Answers (1)

Joys
Joys

Reputation: 11

Hi try change in this line

types: ['geocode'], 

for this

types: ['regions'], 

Regards

Upvotes: 1

Related Questions