You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

36 lines
1.0 KiB

<?php
?>
<head>
<title>地址轉經緯度</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
<body>
<h1>輸入地址以獲取經緯度</h1>
<form id="addressForm" method="post">
<input type="text" id="addressInput" name="address" placeholder="輸入地址">
<button type="submit">查詢</button>
</form>
<div id="map"></div>
<script>
// 使用AJAX提交表單
$(document).ready(function() {
$("#addressForm").submit(function(event) {
event.preventDefault();
var address = $("#addressInput").val();
$.ajax({
url: "get_lat_lng.php",
type: "POST",
data: {
address: address
},
success: function(data) {
$("#map").html(data);
}
});
});
});
</script>
</body>