【发布时间】:2017-12-02 01:50:19
【问题描述】:
我正在学习使用 Google Geolocation API。我有我的钥匙,我只是想制作一个简单的表格,它采用城市名称并使用 Geolocation API 返回纬度和经度。
简单的形式是:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<form>
<fieldset>
<ul>
<li>
<label for="city-search">City Name</label>
<input type="text" id="city-search" placeholder="e.g. Rochester, NY">
</li>
</ul>
</fieldset>
<input type="button" id="sub" value="Submit" onclick="geolocation()">
</form>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script>
<script src="geolocation.js"></script>
</body>
</html>
谁能告诉我如何使用 Geolocation API 以检索输入城市的纬度和经度。
【问题讨论】:
标签: javascript jquery google-maps google-geolocation