Galera to rodando minha aplicação aqui local e está funcionando normalmente, porém no scriptcase ela não funfa apresentando o seguinte erro:
Segue o código: [code]<?php
function retornaGeoCod() {
$array = [];
for($i = 0; $i < 2; $i++){
$array[$i] = [
“lat” => “-19.4746845”,
“long” => “-44.159503”,
“local” => “Prudente de Morais”
];
return $array;
}
}
?>
<script type="text/javascript">
function initMap() {
var myLatLng = {lat: -19.45738, lng: -44.2416695};
//var bh = {lat: -19.9025412, lng: -44.0340901};
var map = new google.maps.Map(document.getElementById(‘map’), {
zoom: 7,
center: myLatLng,
});
/*function retorna(){
for(i = 0; i<2; i++){
return "lat":"-19.4746845",
"long":"-44.159503",
"local":"Prudente de Morais"
}
}*/
var cord =
<?=json_encode(retornaGeoCod())?>;
var infowindow = new google.maps.InfoWindow({
});
for(var i = 0; i<cord.length; i++){
var contentString = cord[i].local;
/var infowindow = new google.maps.InfoWindow({
//content: contentString
});/
//var location = cord.latlong[i].split(",");
var marker = new google.maps.Marker({
position: new google.maps.LatLng(cord[i].lat, cord[i].long),
map: map
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(this.contentString);
infowindow.open(map, this);
});
marker.contentString = cord[i].local;
marker.setIcon('http://imgur.com/tzXd3XW.png');
}
}
</script>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAPjS2aqioGzW8K-33EJWtEzi9LBfMJWNI&callback=initMap">
</script>
[/code]