Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript AJAX Basics (retiring) AJAX and APIs Displaying the Photos

Receiving an Error from the Flickr feed file???

I am receiving an error regarding the json file from Flickr. Here is my code:

$(document).ready(function () {
  $('button').click(function (){
    var flickrAPI = "http://api.flickr.com/services/feeds/photos_public.gne?dsjsonlocalback=?";
    var animal = $(this).text();
    var flickrOptions = {
      tags: animal,
      format: "json"
    function displayPhotos(data) {
      var photoHTML = '<ul>';
      $.each(data.items, function(i, photo) {
        photoHTML += '<li> class="grid-25 tablet-grid-50">';
        photoHTML += '<a href= "' + photo.link + '" class="image">';
        photoHTML += '<img src= "' + photo.media.m + '"></a></li>';
      photoHTML += '</ul>';
    $.getJSON(flickrAPI, flickrOptions, displayPhotos);

The error is an uncaught reference error: jsonFlickrFeed is not defined and its referencing line 1 of api.flickr.com/services/feeds/photos_public.gne?format=json#

1 Answer

Hey Britton,

In your flickrAPI variable, at the end of the URL, it should be: "photos_public.gne?jsoncallback=?".

Thanks Marcus. I found a couple other issues in my code, but your fix was the key. Much appreciated!!

Ah okay excellent! I just skimmed it and saw that first error and figured we'd tackle 'em as they came! :) You're very welcome. Happy Coding! =]