Hello guys I am stuck in the last part of a project.

I have a project were I have infowindows for every marker when the marker is clicked a function "populateInfoWindow" is called. In that function there is a wikiURL based on the marker.title and I get a link to the Wikipedia site search based on that title All good up to here.

My problem starts when I close the infowindow and infowindow.setMarker = null I can not re-open it after that

What am I doing wrong since I am setting the marker to null?

function populateInfoWindow (marker, infowindow){
              var wikiURL = 'https://en.wikipedia.org/w/api.php?action=opensearch&search=' + marker.title + '&format=json&callback=wikiCallback';
              var wikiTimeout = setTimeout(function () {
        alert("failed to load wikipedia page");
    }, 4000);

                     url: wikiURL,
                     dataType: "jsonp",
                     success: function (response) {
                      var articleList = response[3];
                      var articleName = response[0];

                      if (infowindow.marker != marker){
                        infowindow.marker = marker;
                        infowindow.open(map, marker);
                        infowindow.addListener('closeclick', function(){
                        infowindow.setMarker = null;
                         infowindow.setContent('<div>' + '<a href ="' + articleList + '">' + articleName + '</a>'  + '</div>');




Try setting infowindow.marker = null;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.