I'm using this script on javascript to change location and get some variable in the url but window.location.href didn't work i can't redirect to another page
during some search i found i need to put return false;
i put it but also i don't have any result
R: No error message appear
How to solve that ?
function getPosition() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(successPosition);
} else {
document.getElementById("result").innerHTML = "Your browser does not support geo location api"
}
function successPosition(position) {
var lat = position.coords.latitude;
var long = position.coords.longitude;
document.getElementById("result").innerHTML = "Latitude:" + lat + "<br/>Longitude:" + long
window.location.href = "facee.php?lat=" + lat + "&long=" + long;
}
return false;
}
<form method="POST" action="" enctype="multipart/form-data" onsubmit="return getPosition();">
<input type="file" name="image" accept="image/*" capture="camera" class="filestyle" data-buttonBefore="true" data-iconName="glyphicon glyphicon-camera" data-buttonText="Take apicture." />
</div>
<div class="col-md-12"></div>
<div class="col-md-4">
<input type="submit" name="Add" value="Add" class="btn btn-success">
</form>