Guest User

Untitled

a guest
Mar 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. <!-- Map section -->
  2.  
  3. <div class="row">
  4. <div class="col-md-9 col-sm-9 col-xs-9">
  5. <div id="map" style="width: 100%; height: 500px"></div>
  6. </div>
  7. </div>
  8.  
  9. <!-- Modal with form. Inside this modal form i have this input -->
  10.  
  11.  
  12. <input class="form-control" name="pickupLocation" id="txtPickUpLocation" type="text" required>
  13.  
  14.  
  15. <!-- Script Section inside JSP file -->
  16.  
  17. <script>
  18. var autocomplete;
  19. function initializate(){
  20. geocoder = new google.maps.Geocoder();
  21.  
  22.  
  23. //TEMPORARY SOLUTION: Set Manually coordinates (Guayaquil)
  24.  
  25. setCoordinates(-2.159530, -79.894745);
  26. test();
  27. }
  28. function test(){
  29.  
  30. var inputPlace = document.getElementById('txtPickUpLocation');
  31. autocomplete = new google.maps.places.Autocomplete(inputPlace);
  32.  
  33. google.maps.event.addListener(autocomplete, 'place_changed',
  34. function() {
  35. var place = autocomplete.getPlace();
  36.  
  37. console.log('Coordenadas obtenidas');
  38. var lat = place.geometry.location.lat();
  39. var lng = place.geometry.location.lng();
  40.  
  41. });
  42. }
  43. </script>
  44. <script type="text/javascript" src="http://maps.google.com/maps/api/js?key=API_VALID_KEY&libraries=places&callback=initializate"></script>
Add Comment
Please, Sign In to add comment