There is a map in my MVC code. when loads map show some marker on map. So when click on marker, data of this marker pass to another page and show info of marker on new page.
for (i = 0; i < (alarm.length) ; i++) {
marker = new google.maps.Marker({
position: new google.maps.LatLng(alarm[i][0], alarm[i][1]),
map: map, icon: '/Content/alarm.png',
url: 'http://localhost/Alarm/Index/'+alarm[i][3]
});
google.maps.event.addListener(marker, 'mouseover', (function (marker, i) {
return function () {
infowindow.setContent("<br/> No: " + alarm[i][2] + "<br/> Serial: " + alarm[i][3] );
infowindow.open(map, marker);
}
})
(marker, i));
marker.addListener('mouseout', function () {
infowindow.close();
});
google.maps.event.addListener(marker, 'click', function () {
window.location.href =marker.url ;
});
}
This is my code, but when click any marker, it show the same info for all marker.