This is driving me nuts. Using Google Maps v3 I am loading the map using php to determine lat long :
function initialize() {
var latlng = "<?php echo $lat;?>,<?php echo $long;?>";
console.log(latlng);
var mapOptions = {
center: new google.maps.LatLng(<?php echo $lat;?>,<?php echo $long;?>),
zoom: 8,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas")
, mapOptions);
}
This works fine. However if I try to pass in the latlng var
center: new google.maps.LatLng(latlng),
the maps just shows a blue screen and is broken (no zoom or controls or anything). The console log and source look like it is generating the parameters correctly. Any ideas on what might be happening?
I did have initialize()
on body
but I moved it to the (document).ready
in my script. This did not seem to make any difference for this problem.
LatLng(lat, lng)
-- code.google.com/apis/maps/documentation/javascript/… – georg