I am working on pset8. But I am unable to get articles from articles.php. here's what my code looks like:

function getArticles(place)
var articles = "Slow news day!";
var parameter = {geo: place.postal_code};
    type: "GET",
    dataType: "json",
    url: "articles.php",
    data: {geo: place.postal_code},
    success: function(json){
      articles = "<ul>";
       var len = json.length;
       for (var i = 0; i < len; i++)
           articles += "<li><a href=\"" + json[i].link + "\" target = \" _blank \">" + json[i].title + "</li>";
       articles += "</ul>"

return articles;

I have also tried $.getJSON. but it doesn't work

1 Answer 1


Take a look at this:

$.getJSON("articles.php", parameters)
.done(function (data) {
    // here goes the things you do in case it succeeds
.fail(function(jqXHR, textStatus, errorThrown) {
    // log error to browser's console

Although I'm not sure you need a different function for this. I have added it inside a click listener for each marker. Anyway hope this helps. For any disambiguation just leave a comment.

You must log in to answer this question.

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