I connect to the the database and get some information as a json then I Show them when I do this it can easily recognize lan and longtitude and show them on map but when it comes to text that I return to show it when user click on the markers just one text is shown for all and it seems that it attaches the text to first marker for all other markers attach the same text what am I missing? I am totally confused!
for (var i=0; i<tweetsToPlot.length; i++){
var lat = tweetsToPlot[i].lat;
var lng = tweetsToPlot[i].lng;
var myLatLng = new google.maps.LatLng(lat, lng);
var txt=tweetsToPlot[i].text;
var myMarker = new google.maps.Marker({
position: myLatLng,
title: "LatLng Feb 17",
map:map
});
google.maps.event.addListener(myMarker, 'click', function() {
var infowindow = new google.maps.InfoWindow({
content: txt
});
infowindow.open(map, this);
});
var index = tweetsToPlot[i].id;
discs[index] = myMarker;
myMarker.setVisible(true);
}
}