I've almost finished pset8 Mashup but I'm a bit confused as to whether the news articles in the information windows are supposed to open when I click on a news article. I have added markers to my map for locations and when clicked, an infowindow opens with a list of bulleted news articles but I am unable to open any of the articles when I click on a news article link. Should I be able to open any news article when I click on its link in a given infowindow? Any clarification about this would be appreciated.

// display infowindow when clicked

    google.maps.event.addListener(marker, 'click', function() {


    // gets JSON for the news articles

    $.getJSON("articles.php", {geo: place.place_name})
    .done(function(data, textStatus, jqXHR )

    if (data.length === 0)
        showInfo(marker, "No news today :(");

        var content = "<ul>";

        // template for ul

        var template = _.template("<li><a href'<%- link %>' target='_blank'>'<%- title %>'</a></li>");

        // iterate through the news

        for (var i = 0; i < data.length; i++)

        content+= template({link: data[i].link, title: data[i].title});

        // close list

        content+= "</ul>";

        // show infowindow

        showInfo(marker, content);


    .fail(function(jqXHR, textStatus, errorThrown) {

    // log error to browser's console




  • Yes, you should Dec 10 '16 at 18:23
  • If I can't open any of the news articles then what is likely to be the problem? Dec 11 '16 at 12:37
  • That would be difficult to answer without seeing your code, right? Dec 11 '16 at 12:37
  • I agree. I'm sure that the problem lies in my scripts.js file Dec 11 '16 at 12:46
  • Couldn't you just edit your original post? Dec 11 '16 at 13:11

You're missing an equal sign = after href here:

var template = _.template("<li><a href'<%- link %>' target='_blank'>'<%- title %>'</a></li>");

should be:

var template = _.template("<li><a href='<%- link %>' target='_blank'>'<%- title %>'</a></li>");

If this solves your problem, please click the gray check to the left of the page to accept this answer and close this question.

  • Thanks so much. I can now open any news article. Dec 11 '16 at 13:35
  • Great! You can delete all those comments with code up there later, then! Good luck on the next task. Dec 11 '16 at 13:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .