Discovering the user's IP address to display a modal

0

Good afternoon, I would like to get the values of the geolocation of the user and to display a model if it is in a certain location, I can get the values of coordinates, but how do I pass those php values to the php? p>

<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>

    
asked by anonymous 28.09.2018 / 22:04

0 answers