I am trying to add an info window when the user clicks on the marker on the map. When I click the marker to test, I am getting this error: Uncaught TypeError: Cannot read property '__e3_' of undefined
. Here is my code:
for(var i = 0; i < final_search_results.length; ++i) {
var title = ("Parameter: " + final_search_results[i].parm_desc + "; Date: " + final_search_results[i].date + "; Result: " + final_search_results[i].result);
var markerLatlng = new google.maps.LatLng(final_search_results[i].st_id.lat_coord, final_search_results[i].st_id.long_coord); // Add the coordinates
var marker_icon = new google.maps.MarkerImage("./marker_icon.png", null, null, null, new google.maps.Size(64,64))
var marker = new google.maps.Marker({
position: markerLatlng,
icon: marker_icon,
map: map,
title: title
});
marker['result'] = final_search_results[i].result;
marker['date'] = final_search_results[i].date;
marker['time'] = final_search_results[i].time;
marker['station'] = final_search_results[i].st_id.station_id;
marker_array.push(marker);
}
for(var k = 0; k < marker_array.length; ++k) {
var content = ("<p>Station: " + marker_array[k].station + "; Date: " + marker_array[k].date + "</p>");
var infowindow = new google.maps.InfoWindow({ // Create a new InfoWindow
content: content// HTML contents of the InfoWindow
);
google.maps.event.addListener(marker[k], 'click', function() { // Add a Click Listener to our marker
infowindow.open(map,marker[k]); // Open our InfoWindow
});
}
I only get this error when I click the marker. Everything was fine before I added the code blow the *
. If you would like to see more code just let me know.