Aaron
Aaron

Reputation: 2755

jQuery: jsonFlickrFeed not working

I am trying to call my photos in flicker so I could use them in my photo gallery.

But my code does not retrieve anything.

I watched it from lynda.com I included this line of code

<script src="http://api.flickr.com/services/feeds/photos_public.gne?id=[MY_ID]&format=json&tags=viewsource">

Note [My_ID] = of course my ID.

When I run it in my browser it shows the jsonFlickrFeed completely with the objects.

However, when I call it in my script

function jsonFlickrFeed(data) {
   console.log(data);
}

Nothing shows up in my console. I need to retrieve the photos so I could display them in my gallery. Thanks

Upvotes: 0

Views: 1051

Answers (1)

jogesh_pi
jogesh_pi

Reputation: 9782

Take a look on getJSON() method, that also has an example to fetch photos from flicker.

var flickerAPI = "http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?";
 $.getJSON( flickerAPI, {
   tags: "mount rainier",
   tagmode: "any",
   format: "json"
 })
 .done(function( data ) {
  $.each( data.items, function( i, item ) {
    $( "<img>" ).attr( "src", item.media.m ).appendTo( "#images" );
    if ( i === 3 ) {
      return false;
    }
  });
});

Upvotes: 1

Related Questions