I'm trying to create a function that returns a object with information of a callback:
var geoloc;
var successful = function (position) {
geoloc = {
longitude: position.coords.longitude,
latitude: position.coords.latitude
};
};
var getLocation = function () {
navigator.geolocation.getCurrentPosition(successful, function () {
alert("fail");
});
return geoloc;
};
How can I do this? The function getLocation return null value before successful is executed.
Thanks!
}ingetLocation.l's and too fews's insuccessful... ;)