Advertisement
Guest User

Untitled

a guest
Mar 5th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 0.90 KB | None | 0 0
  1. <html>
  2. <head>
  3. <meta charset="UTF-8">
  4. <title>Geo Localización</title>
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <meta name="apple-mobile-web-app-capable" content="yes">
  7. <script src="Jquery/jquery.js"></script>
  8. </head>
  9. <body>
  10. <h1>Resultados</h1>
  11. <div id="respuesta"></div>
  12.  
  13. </body>
  14. </html>
  15.  
  16. <script>
  17. $(document).on("ready", inicio);
  18. function inicio() {
  19.     geolocalizar();
  20. }
  21.  
  22. function geolocalizar () {
  23. navigator.geolocation.getCurrentPosition(mostrar, correrEnCirculos);
  24. }
  25.  
  26. function correrEnCirculos(errorsh){
  27.  
  28.     alert("Tarde o temprano te encontrare");
  29.     cosole.log(errorsh);
  30. }
  31.  
  32. function mostrar(geo) {
  33.  
  34.     lat = geo.coords.latitude;
  35.     lon = geo.coords.longitude;
  36.    
  37.     mostrarResultados();
  38.    
  39. }
  40.  
  41. function mostrarResultados() {
  42.  
  43.     $("#respuesta").append(lat);
  44.     $("#respuesta").append(lon);
  45.  
  46.  
  47.     console.log(lat);
  48.     console.log(lon);
  49.    
  50. }
  51.  
  52.  
  53. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement