I am working with Geocoder to get user position and do stuff , but I am having difficulty to return the map object and properties inside it for external use .
My code .
function success(position)
{
var map = new google.maps.Map(document.getElementById("mapcanvas"), myOptions);
var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
***do more
}
if (navigator.geolocation) {navigator.geolocation.getCurrentPosition(success, handleerror)}
Ok , so now how do I return the map and the latlng object externally ? I couldn’t use global variable because the variables are still undefined before navigator.geolocation kick in .
Update Easy way , I’ll just use jquery to write those coordinate , which the only thing I need ,to a hidden HTML input and further use it from here . Thanks
Easy way , I’ll just use jquery to write those coordinate , which the only thing I need ,to a hidden HTML input and further use it from here . Thanks