Hi I have a piece of javascript code which i want to call every two minutes, however i can not seem to get it to work, when the page loads for the first time it works fine, but it doesn't update after that.
Please see code below:
function position(){
var a=setTimeout(position,60000);
}
if(navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(function(position)
{
var lat = position.coords.latitude;
var lon = position.coords.longitude;
var xmlHttp = new XMLHttpRequest(); //not the cross browser way of doing it
xmlHttp.open("GET", "locator/test1.php?lat=" + lat + "&lon=" + lon, true);
xmlHttp.send(null);
});
}
Thanks