0
Good afternoon, I would like to take the values of user geolocation and display a model if it is in a certain location, I can get the values of coordinates, but how do I pass php these values that are in javascript?
<div>
<p id="demo">Clique no botão para receber sua localização em Latitude e Longitude:</p>
<button onclick="getLocation()">Clique Aqui</button>
<script>
var x=document.getElementById("demo");
function getLocation()
{
if (navigator.geolocation)
{
navigator.geolocation.getCurrentPosition(showPosition);
}
else{x.innerHTML="O seu navegador não suporta Geolocalização.";}
}
function showPosition(position)
{
x.innerHTML="Latitude: " + position.coords.latitude +
"<br>Longitude: " + position.coords.longitude;
}
</script>
using the so-called ajax
– user76097
I’ll try, thank you
– Caio Brandão
Make a GET or POST request to your php
– Leandro Angelo