I'm trying the code of the 1st answer here: Phonegap with Compass and GPS coordinates.
I want to adapt that don't need to input the latitude and longitude, only with 1 button saves the current position and the app start working.
I tryed making that a button call this function:
function locate(){
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(locationSuccess, locationError);
}
else {
showError("Your browser doesn't support geolocation!");
}
}
function locationSuccess(position) {
$('input[id=target-lat]').val('position.coords.latitude');
$('input[id=target-lon]').val('position.coords.longitude');
}
Any can say me what I'm making wrong?
Thanks for all.