I'm working with the following code (PHP within JavaScript). The foreach is working and it's echoing out the results when I check the console but the map script doesn't work.
var t = [];
var x = [];
var y = [];
var h = [];
<?php foreach($obj->data as $mapMarkers) {
echo "t.push('" . json_encode($mapMarkers->AreaName . "');\n";
echo "x.push(" . $mapMarkers->Longitude . ");\n";
echo "y.push(" . $mapMarkers->Latitude . ");\n";
echo "h.push('" . $mapMarkers->FullAddressBR . "');\n";
} ?>
var i = 0;
for ( item in t ) {
var m = new google.maps.Marker({
map: google_map,
animation: google.maps.Animation.DROP,
title: t[i],
position: new google.maps.LatLng(x[i],y[i]),
html: h[i]
});
google.maps.event.addListener(m, 'click', function() {
info_window.setContent(this.html);
info_window.open(google_map, this);
});
i++;
}