Hot answers tagged

2

You told the program to "get" info from "articles" here $.getJSON(Flask.url_for("articles")) but you didn't tell it what to GET. Assuming your articles function returns data as per the examples (eg https://ide50-username.cs50.io/articles?geo=02138), you need to send a "query string" to articles. Use the supplied search function as a guide: function search(...


1

The jQuery doc for getJSON says it takes a url as an argument. (First hit with "jquery getJSON" search using Google). The flask doc for url_for (first hit from internet search for "flask url_for" and searching the document) offers another link for Quickstart. The (supplied) search function shows the pieces in action (no google required :) function search(...


1

Syntax mistake in this loop: for (var key in data) { if (data.hasOwnProperty(key)) { content += "<li><a href=\"" + data['link'] + "\" >" + data['title'] + "</a></li>"; } } You should use either: 1 - data[key]['link'] etc if you use for in loop 2 - key['link'] if you use for of loop (but I guess this ...


1

When you first click the marker, the .done() function hasn't delivered your JSON data yet, thus content will still be "" when you call showInfo(marker, content); at the very end. Try to move showInfo(marker, content); inside your .done() function, as the last command to be executed inside it. If this solves your problem, please click the check button to ...


Only top voted, non community-wiki answers of a minimum length are eligible