I've been working on addMarker for way too long, and figured it was time to ask for help.
I've got the function to the point where the info window will open upon click, and show the loading gif. I've also successfully iterated through what is returned from getJSON using $.each and can output the title and link via console.log. However, what I've really struggled on is incorporating the HTMl.
Through helpful SO answers I've used the push and append method, however I can't seem to figure out how to wrap the entire thing in a div or ul so that the result can be called by showInfo.
Code is below, thanks in advance.
// Create an info window
var infowindow = new google.maps.InfoWindow();
marker.addListener('click', function() {
// Return JSON of articles for this marker place
$.getJSON(Flask.url_for("articles"), {geo:place.postal_code})
.done(function(data, textStatus, jqXHR) {
var ul = '<ul>';
var articlez = [];
$.each(data, function(i, article) {
articlez.push('<li><a href="' + article.link + '">'
+ article.title + '</a></li>');
});
$('#ul').append( articlez.join('') );
'</ul>'
})
showInfo(marker, ul)
});