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=”http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places”></script>

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

    autocomplete = new google.maps.places.Autocomplete(input,options);
});
</script>

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

About the author

Being the CEO and Founder of ClecoTech International, Mr. Ashish Prajapati is dedicated towards his aim of mentoring young startups into a full-fledged businesses. He is helping startups from America, Europe, India, and various other countries through proper guidance and the use of latest technologies to develop their innovation and ideas into definite realities.

Comments

Leave a Reply to seo star jony Cancel reply

Your email address will not be published. Required fields are marked *