[英]Google Places API places types issue
我正在使用下面詳述的代碼來獲取全球機場的自動完整文本字段,但是它沒有任何結果,但是,如果我將類型從機場更改為城市,則可以正常工作。
HTML:
<html>
<head>
<title></title>
<meta charset="UTF-8">
<meta name="author" content="">
<meta name="description" content="">
<meta name="keywords" content="">
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=false"></script>
<script type="text/javascript" src="js/geo.js"></script>
</head>
<body>
<div class="container">
<div class="header"></div>
<div id="nav-bar">
<!-- <?php include ("nav-bar.php"); ?> -->
</div>
<div class="content">
<div class="left-panel"></div>
<div class="right-panel">
<form action="">
Origin:<br>
<input type="text" name="" id="searchTextField"><br>
Destination:<br>
<input type="text" name=""><br>
Departure:<br>
<input type="date" name=""><br>
Return:<br>
<input type="date" name=""><br>
</form>
</div>
</div>
<div class="footer"></div>
</div>
</body>
JS:
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);
支持的類型列表: https : //developers.google.com/places/supported_types
非常感謝您提供任何幫助,並且一如既往地感謝您抽出寶貴的時間閱讀本文。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.