我有这个函数:
navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
从手机获取当前GPS位置。现在,当我按下"确认"在手机上,在做检索位置的请求之前,我想调用一个函数(所以,不是在foundLocation()
中,位置数据已经准备好了)。
我该怎么做?
<button id="btnConfirm">Confirm</button>
document.getElementById("btnConfirm").onclick = function()
{
call_your_function();
navigator.geolocation.getCurrentPosition(foundLocation, noLocation);
}