I have some problems with the javascript for my user coordinates. In all examples they print an alert message on the return callback from geolocation, but I want to use the lat,long coordinates for printing or setting other values. What is the problem with this code? Can anyone be kind and explain: :)
<script type="text/javascript">
navigator.geolocation.getCurrentPosition(success);
function success(position) {
var lat = position.coords.latitude;
var long = position.coords.longitude;
}
document.write(lat);
</script>
and this is the errorcode with phonegap:
05-12 16:40:35.486: E/Web Console(15962): ReferenceError: Can't find variable: lat at file:///android_asset/www/showMap/showMap.html:31
Thanks