我想在特定的城市使用google place api而不是全世界。
目前我使用下面的代码
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places&types=(locality)&input={ahemdabad}" type="text/javascript"></script>
<script type="text/javascript">
function initialize() {
var input = document.getElementById('searchTextField');
var autocomplete = new google.maps.places.Autocomplete(input);
}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
<input id="searchTextField" type="text" size="50" placeholder="Enter a location" autocomplete="on">
答案 0 :(得分:0)
<script>
function initialize() {
var input = document.getElementById('searchTextField');
var autocomplete = new google.maps.places.Autocomplete(input);
var marker = new google.maps.Marker({
position: map.getCenter(),
map: map,
title: "hi"
});
}
</script>';