Send coordinates from google maps to mysql

0
<script>
        document.addEventListener("deviceready",onDeviceReady,false);
        function onDeviceReady(){
            console.log("listo");   
        }

        function getDatos(){
             navigator.geolocation.getCurrentPosition(onSuccess,onError,{maximunAge: 300000,timeout:10000, enableHighAccuracy:true});
        }

        function onSuccess(position){
            var latitud=document.getElementById("latl");

            var longitud=document.getElementById("lonl");

            latitud.innerHTML=""+position.coords.latitude; 
            longitud.innerHTML=""+position.coords.longitude;
            var coords= new google.maps.LatLng(position.coords.latitude,position.coords.longitude);

            var opciones = {center: coords, zoom: 15, mapTypeId: google.maps.MapTypeId.ROADMAP};

            var mapa = new google.maps.Map(document.getElementById("map"),opciones);

            var marcador= new google.maps.Marker({
                position:coords,
                map: mapa,
                title: "Tu positions",
                animation: google.maps.Animation.DROP
            });

        }

        function onError(err){ 
            console.log("codigo de err:"+err.code+"  msj="+err.message);
        }

    </script>




<div id="datos" class="">
                    <button onclick="getDatos();">Capturar Posicion</button>
               <div>

                   <!--  <label>Latitud:</label><label id="latl"></label> -->
                     <input type="hidden" id="latl"  value=""/>
               </div>
               <div>

              <!--     <label>Longitud:</label><label id="lonl"></label> -->
                   <input type="hidden" id="lonl"  value=""/>
               </div>
            </div>
            <div id="map">

            </div>

        </div>
        <div class="item">
            <input type="button" id="insert" class="button button-block" value="Insertar" />
        </div>
    
asked by Marco polo 27.06.2018 в 07:29
source

0 answers