I am trying to pass two variables (latitude and longitude) to the google.maps.StreetViewPanorama method without success. Is it possible to do that or I am failing ?
The variables are passing via the url:
http://mydomain/street.php?lat=41.653048&lon=-0.880677
The code of street.php is:
<?php
$lat = $_GET["lat"];
$lon = $_GET["lon"];
?>
<html>
<head>
<meta name='viewport' content='width=320,user-scalable=no'/>
<script src='http://maps.google.com/maps/api/js?sensor=false' type='text/javascript' >
jlat = <?php echo $lat; ?>
jlon = <?php echo $lon; ?>
</script>
</head>
<body onload="new google.maps.StreetViewPanorama(document.getElementById('p'),
{position:new google.maps.LatLng(jlat, jlon)
});"
style='padding:0px;margin:0px;'>
<div id='p' style='height:100%;width:100%;'></div>
</body>
</html>
I the i have fefined the new javescript variable
jlat = <?php echo $lat ?>
jlon = <?php echo $lon ?>
that hen i pass to the google.maps.LatLng(jlat, jlon), but it doesn't work.
Any idea about that?
Thanks in advance
var lat = ...andvar lon = ...