Jump to content

Recommended Posts

Posted

Olá bom dia a todos,

Eu gostava de passar duas variaveis de javascript para o php como é possivel?

Eu tenho isto:

<?
$localizacao = "maia, porto";
?>

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
var geocoder = new google.maps.Geocoder();
var address = "<?=$localizacao?>";
geocoder.geocode( { 'address': address}, function(results, status) {
 if (status == google.maps.GeocoderStatus.OK) {
var latitude = results[0].geometry.location.lat();
var longitude = results[0].geometry.location.lng();
alert(latitude);
//alert(longitude);
 }
});
</script>

<?php
  // Pegar var de javascript
  $minha_latitude = "";
  $minha_latitude = "";
?>

Tenho andado aqui as voltas mas não consigo passar a latitude e longitude para as variaveis em php mas nao consigo, alguem me consegue ajudar?

Posted

Passa por $_GET ou $_POST.

"Que inquieto desejo vos tortura, Seres elementares, força obscura? Em volta de que ideia gravitais?" >> Anthero de Quental

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Linuxando.com | ...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.