0

I can't get the news articles to show up inside of the markers on mashup. I tried debugging with the console, but all I get is an error 500 from the articles function, although when I tested articles directly through the url (https://ide50-username.cs50.io/articles?geo=02138) I got the JSON object as expected. I suspect I'm using getJSON wrong, but I can't figure out how. Can anyone tell me what is wrong? Here is addMarker:

function addMarker(place){
    var latitude = place.latitude;
    var longitude = place.longitude;

    var marker = new google.maps.Marker({
    position: new google.maps.LatLng(latitude,longitude),
    map:map,
    visible:true
    });

    $.getJSON(Flask.url_for("articles"), function(news){
       google.maps.event.addListener(map, "click",function(){
            showInfo(marker, news.title);
       });
    });

    marker.setMap(map);
    markers.push(marker);
}

1 Answer 1

1

When you access articles through the url, you send the query string geo=02183. When you call articles in the .getJSON, you haven't told it "where to look". Review the supplied search function for a clue:

function search(query, syncResults, asyncResults)
{
    // get places matching query (asynchronously)
    var parameters = {
        q: query
    };
    $.getJSON(Flask.url_for("search"), parameters)

You must log in to answer this question.

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