-
-
Save scriptdev/50b2d34954adfcb0264f29bd17701009 to your computer and use it in GitHub Desktop.
PEGAR COORDENADAS LATITUDE e LONGITUDE E ABRIR NO MAPA
This file contains 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
<?php | |
public static function onAbrirMapa($param = null) | |
{ | |
try | |
{ | |
TScript::create(" | |
if (navigator.geolocation) { | |
navigator.geolocation.getCurrentPosition(function(position) { | |
var latitude = position.coords.latitude; | |
var longitude = position.coords.longitude; | |
$('#latitude').val(latitude); | |
$('#longitude').val(longitude); | |
var url = 'https://www.google.com/maps?q=' + latitude + ',' + longitude; | |
window.open(url, '_blank'); | |
}); | |
} | |
"); | |
} | |
catch (Exception $e) | |
{ | |
new TMessage('error', $e->getMessage()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment