我有与文档中相同的自动完成脚本:https ://developers.google.com/maps/documentation/javascript/examples/places-autocomplete
我的包含脚本:
<script type="text/javascript" src="//maps.google.com/maps/api/js?v=3.8&sensor=false&libraries=geometry,places&language=&hl=®ion=FR"></script>
的JavaScript:
function initAutocomplete(callback, input_s, lat_s, lng_s, label_s) {
var input = $(input_s)[0];
var autocomplete = new google.maps.places.Autocomplete(input);
//autocomplete.bindTo('', search_map.map);
google.maps.event.addListener(autocomplete, 'place_changed', function () {
var place = autocomplete.getPlace();
if (place.geometry) {
$(lat_s).val(place.geometry.location.lat());
$(lng_s).val(place.geometry.location.lng());
$(label_s).val(place.formatted_address);
if (callback) {
callback();
}
}
});
}
initAutocomplete(somefunction, '#zipcode_search_input', "#search_lat", "#search_lng", "#search_address_label");
我希望结果偏向于法国城市。例如:如果我输入“laval”,我想Laval, France
先出现,然后Laval, Canada
。
在包含脚本中指定 region or language
, region
orhl
没有帮助。我怎样才能使结果偏向法国?