I am learning to use Google Geolocation API. I have got my key and I am just trying to make a simple form which takes the city name and returns me the latitude and longitude using Geolocation API.
The simple form is :
<!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>
Can anyone tell me how to use the Geolocation API in a way that I can retrieve the latitude and longitude of the entered city.