i have written the following code and google markers are not working. If I put the marker creation outside the httpRequest work fine. What is the problem ?
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (this.readyState == 4 && this.status == 200) {
var coordinates = JSON.parse(this.responseText);
for (point of coordinates) {
console.log(point);
var marker = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(point[0], point[1])
})
}
}
};
xhttp.open("GET", "../php/createAdresses.php", false);
xhttp.send();
Aucun commentaire:
Enregistrer un commentaire