0

Why can I not get a list of links this way? I am getting the inputs right if I am not using a href ? I mean I am getting a list of links if I am not using href but when I do I am getting a list of empy elements. Please could you help me?

function addMarker(place)
{
//creating a markerk picture

var iconBase = 'https://maps.google.com/mapfiles/kml/shapes/';

var title = place.place_name + ' ' + place.postal_code;
var lati = (_.isNumber(place.latitude)) ? place.latitude : parseFloat(place.latitude);
var long = (_.isNumber(place.longitude)) ? place.longitude : parseFloat(place.longitude);
//create a marker
var marker = new google.maps.Marker({
position : {lat : lati, lng: long},
map : map,
icon : {anchor : new google.maps.Point(1000,60)},
label : place.place_name
//title: title
});
markers.push(marker);
marker.setMap(map);

var content = '<ul>\n';
var query = place.place_name; // or concatenate more stuff here
var parameters = {
    geo: query
};

$.getJSON("articles.php", parameters)
.done(function(data, textStatus, jqXHR) {

    // return data to content
    for (var i = 0; i < data.length; i++)
    {
        var link = "'"+ data[i].link  +"'";
        content += "<li><a href ="+ link + "></a></li>";
        // actually, you'll need to concatenate some HTML around data[i]
        // to make it a list item and a hypertext link
    }
    content += '</ul>';
})
.fail(function(jqXHR, textStatus, errorThrown) {

    // log error to browser's console
    console.log(errorThrown.toString());
});
marker.addListener('click', function() {
    showInfo(marker, content);
});


}

1 Answer 1

1

You forgot to add some text between the <a ...> and </a> like this: <a href="yourlink">text here!!</a>

1
  • 1
    Thank you that was so easy mistake but I shall remember it through the rest of my life hehe.
    – Kamil Kug
    Commented Oct 26, 2016 at 8:01

You must log in to answer this question.

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