Address Search Using Google Search Autocomplete With Restricted Countries

We can easily search the particular address with Street No,Street,City,State and Country using google search autocomplete, below my code is implement in ruby on rails

Here my java script

<script src=";libraries=places"></script>

<script type="text/javascript">
 // script for address autocomplete search
    var autocomplete;
    var geocoder;
    var input = document.getElementById('advertiser_address');
    var options = {
      componentRestrictions: {'country':'us'}

    autocomplete = new google.maps.places.Autocomplete(input,options);

here componentRestrictions says that we can search only particular country addresses.  

No comments:

Post a Comment