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() {
showInfo(marker);
// 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 :(");
}
else
{
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
console.log(errorThrown.toString());
});
});
}