I finally got the news headlines to populate the infobox. However, I havent wired up the links to the individual articles. Do all I need to do is add an "a href" tag to the json? Also, I cant click on markers. They wont pop up.One does automatically when I enter a destination, though. I think its because I have it inside of my JSON call. How can I fix this without breaking my code?

 function addMarker(place)
   markers = place;
   var myLatlng = new google.maps.LatLng(parseFloat(markers.latitude),parseFloat(markers.longitude));

   var marker = new google.maps.Marker({
    position: myLatlng,
    map: map

   var parameters = {geo: markers.postal_code};
   $.getJSON("articles.php", {geo : markers.postal_code}).done(function(data, textStatus, jqXHR) {
    var content = data;
    var articles = "";
    var len = data.length;
    for(var i = 0; i<len;i++){
        articles += "<div>"+content[i].title+"</div>"
    if(articles.length === 0){
      articles = "Slow News Day!";
    showInfo(marker, articles);


Regarding the links, the following worked for me:

var articles = "<ul>";
          var len = data.length;

          for (var i = 0; i < len; i++) {

              articles += "<div><li> <a href=\"" + data[i].link + "\" target=\"_blank\">" + data[i].title + "</li></div>";

          articles += "</ul>";

And regarding the markers won't opening, I think you have to add a DOMlistener

Check the last line of the first example in this page

Hope that helped, your for loop idea was also useful to me.

  • Looks like a closing anchor tag is missing. Dec 30 '15 at 16:41

You must log in to answer this question.

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