如何在数据库中插入经度和纬度?

时间:2019-06-27 13:31:31

标签: javascript html

我们如何在输入字段中插入纬度和经度并将其保存到数据库中?

<script>
function showlocation(){
	navigator.geolocation.watchPosition(callback);
}
function callback(position){
	document.getElementById('latitude').innerHTML=position.coords.latitude;
	document.getElementById('longitude').innerHTML=position.coords.longitude;
}
</script>
<!DOCTYPE html>
<html>
<body>
Click Show location button and run :)
<input type="button" value="Show Location" onclick="showlocation()"/> 

<br/>
Latitude: <span id="latitude">..</span> <br>
Longitude: <span id="longitude">..</span>

</body>
</html>

0 个答案:

没有答案