Created
September 7, 2012 16:58
-
-
Save sebasjm/3667766 to your computer and use it in GitHub Desktop.
geoloc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!-- GEO LOC --> | |
| <script type="text/javascript" src="https://maps.google.com/maps/api/js?sensor=true"></script> | |
| <input id="ubicacion" type="text" value="" /> <a href="javascript:confirmar_ubicacion()"> confirmar ubicación </a> | |
| <script> | |
| // new google.maps.Geocoder().geocode({'address':'buenos aires'},function(r,s){$('#personal-data-location-input').html(pepe(r[0].formatted_address));}) | |
| function confirmar_ubicacion(){ | |
| var geocoder = new google.maps.Geocoder(); | |
| var ubicacion = $('#ubicacion').val(); | |
| if (!ubicacion || ubicacion == "") console.log( "Something went wrong"); | |
| geocoder.geocode( | |
| {'address': ubicacion}, | |
| function(results, status){ | |
| if (status == google.maps.GeocoderStatus.OK) { | |
| if (results[0]) { | |
| ubicacion = results[0].formatted_address; | |
| $('#ubicacion').val( ubicacion ); | |
| } | |
| } | |
| } | |
| ); | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment