gpt4 book ai didi

javascript - 机场的 Google Places 自动完成功能

转载 作者:数据小太阳 更新时间:2023-10-29 06:06:25 24 4
gpt4 key购买 nike

我正在尝试使用 Google 的自动完成地点 API 为机场构建一个自动完成功能。我在这里的一个问题中找到了以下代码,但没有返回任何结果: Setting Google Places 'Types' on Dropdown Input

<script type="text/javascript">
function initialize()
{
var input = document.getElementById('searchTextField');
var options = {
types: ['airport'],

};

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

google.maps.event.addDomListener(window, 'load', initialize);
</script>
<input id="searchTextField" type="text" size="50" placeholder="Search for an Airport!">

谁能帮帮我?

最佳答案

没有airport地点类型。

https://developers.google.com/maps/documentation/javascript/reference#AutocompleteOptions

types | Array.<string>

The types of predictions to be returned. For a list of supported types, see the developer's guide. If nothing is specified, all types are returned. In general only a single type is allowed. The exception is that you can safely mix the 'geocode' and 'establishment' types, but note that this will have the same effect as specifying no types.

Types supported in place autocomplete requests

关于javascript - 机场的 Google Places 自动完成功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27069920/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com