navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
function successCallback(position) {
let lat=position.coords.latitude;
let lon=position.coords.longitude;
$("#lon").text(lon);
$("#lat").text(lat);
var map = L.map('map').setView([lat, lon], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
}).addTo(map);
L.marker([lat, lon]).addTo(map)
.bindPopup('你現在的位置在這邊')
.openPopup();
}
function errorCallback(error) {
console.log(error)
}