Guest User

Untitled

a guest
Jan 22nd, 2018
281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.94 KB | None | 0 0
  1. <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAOtXC1s0pg6INM7UEWlt1g3Vi14OpD50Q&callback=initMap"
  2. type="text/javascript"></script>
  3.  
  4. <script type="text/javascript">
  5.  
  6. window.onload = function() {
  7. navigator.geolocation.getCurrentPosition(fn_ok, fn_error);
  8. }
  9. function fn_error() {
  10. var divMapa = document.getElementById('mapa');
  11. divMapa.innerHTML = 'hay un problema al solicitar los datos';
  12. }
  13. function fn_ok(respuesta){
  14. var divMapa = document.getElementById('mapa');
  15. var lat = respuesta.coords.latitude;
  16. var lon = respuesta.coords.longitude;
  17.  
  18.  
  19. $("button[name='btnCiudad']").each(function(){
  20.  
  21. $(this).bind( "click",function() {
  22. // Generar enlace
  23. var destino = $(this).val();
  24. var enlace = 'http://maps.google.com/maps?saddr='+ lat + ',' + lon + '&daddr=' + destino;
  25. document.getElementById('ruta').href = enlace;
  26. });
  27. });
  28.  
  29. }
  30.  
  31. </script>
  32.  
  33. I/chromium: [INFO:CONSOLE(249)] "Google Maps API warning: SignedInNotSupported https://developers.google.com/maps/documentation/javascript/error-messages#signed-in-not-supported", source: https://maps.googleapis.com/maps-api-v3/api/js/31/6/util.js (249)
  34.  
  35. [INFO:CONSOLE(100)] "Uncaught InvalidValueError: initMap is not a function", source: https://maps.googleapis.com/maps/api/js?key=AIzaSyAOtXC1s0pg6INM7UEWlt1g3Vi14OpD50Q&callback=initMap (100)
  36.  
  37. <script src="https://maps.googleapis.com/maps/api/js?key= AIzaSyAOtXC1s0pg6INM7UEWlt1g3Vi14OpD50Q&signed_in=true"></script>
Add Comment
Please, Sign In to add comment