我们如何在输入字段中插入纬度和经度并将其保存到数据库中?
<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>