Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Map section -->
- <div class="row">
- <div class="col-md-9 col-sm-9 col-xs-9">
- <div id="map" style="width: 100%; height: 500px"></div>
- </div>
- </div>
- <!-- Modal with form. Inside this modal form i have this input -->
- <input class="form-control" name="pickupLocation" id="txtPickUpLocation" type="text" required>
- <!-- Script Section inside JSP file -->
- <script>
- var autocomplete;
- function initializate(){
- geocoder = new google.maps.Geocoder();
- //TEMPORARY SOLUTION: Set Manually coordinates (Guayaquil)
- setCoordinates(-2.159530, -79.894745);
- test();
- }
- function test(){
- var inputPlace = document.getElementById('txtPickUpLocation');
- autocomplete = new google.maps.places.Autocomplete(inputPlace);
- google.maps.event.addListener(autocomplete, 'place_changed',
- function() {
- var place = autocomplete.getPlace();
- console.log('Coordenadas obtenidas');
- var lat = place.geometry.location.lat();
- var lng = place.geometry.location.lng();
- });
- }
- </script>
- <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