The marker on click will call a function called calcRoute. I also want to display a text content near the marker when the marker is clicked.
var textContent = "Some text";
var marker = new google.maps.Marker({
map: map,
title: MALL.mall.name,
position: pos
});
google.maps.event.addListener(marker, 'click', (function () {
calcRoute();
}));
Seeing that you’ve tagged your question “infowindow”, you should try it:
https://developers.google.com/maps/documentation/javascript/overlays#InfoWindows