Hello,
I am trying to "transfer" geolocation-data to a php script.
I think, that the reason it wont work is, i can't get the varible from outside the function.
So far, i got this code.
How do i get it to work?! :)
<body onload="office_getLocation()">
<script src="min.js" type="text/javascript"></script>
<script type="text/javascript">
function office_getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
}
function showPosition(position)
{
var lat = position.coords.latitude;
var lon = position.coords.longitude;
}
$(function() {
getStatus();
});
function getStatus() {
$('div#status').load("upload.php?la=" . lat . "&lo=" . lon);
setTimeout("getStatus()",1000);
}
</script>
<div id="status"></div>
</body>