Hello,
I've been trying to do this all day: I want to load a map, create multiple polygons and when the user clicks a polygon an infoWindow should appear with content from a blogpost corresponding to the clicked polygon.
Everything is working except I can't get my head around loading a specific post from JavaScript. Can I somehow load the content into the infowindow using AJAX?
This is my code to show the infoWindow:
function showMyWindow(event){
var contentString = "Somehow load the content();";
// Replace our Info Window's content and position
infowindow.setContent(contentString);
infowindow.setPosition(event.latLng);
infowindow.open(map);
}
I'm using the latest Google Maps API.
Any help is much appreciated!