I have implemented Google map API on search. My code is working properly till auto generated location but I want such facility by which I can get exact location by providing only city name not whole format string.
For ex:
Please check this image http://demo.ncryptedprojects.com/nct_bnb_clone_new/Untitled.png
I'm entering city name Mumbai in search box and Google map API retrieves all values in drop-down. When someone does not choose any value from drop down and directly presses enter after city name I cant get exact search for city Mumbai in map. What I exactly want to do is, when someone enters city name and then search it should automatically search first occurrence from drop-down like "Mumbai Maharashtra,India"
HTML form
<input name="location" id="location" type="text"/>
Google map API
<script src="https://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
$(function() {
var e;
e = $('.search-form input[name="location"]')[0];
return new google.maps.places.Autocomplete(e, {
types: ["geocode"]
})
});