嗨,我有这个用于地理位置查找的代码
<html>
<head>
<title>fs</title>
<p id="demo"></p>
<script type="text/javascript"> function get_stored_data() {
alert(localStorage.value); }
var x = document.getElementById("demo");
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showPosition);
} else {
x.innerHTML = "Geolocation is not supported by this browser.";
}
}
function showPosition(position) {
x.innerHTML = "Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
</head>
<body>
<p>The element below will receive content</p>
<div id="div" />
<script type="text/javascript">getLocation()</script>
</body>
</html>
我想将纬度和经度的值发送到 php 文件 这会将其写入文本文件
最佳答案
我使用 $_GET 或 $_POST 方法将数据传递到另一个 PHP 页面
关于javascript - 将 html5 值发送到 php,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40817057/