KJai
KJai

Reputation: 1705

json returning list

I want to see an example of how to consume out of domain json service that returns list of items.

Can anyone point me towards a 'real' example to see how it is done.

Upvotes: 0

Views: 859

Answers (1)

Neil McKeown
Neil McKeown

Reputation: 445

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

Not entirely sure what you mean by 'consume the service', but this loads the four most recent cat pictures from the Flickr JSONP API.

source

Upvotes: 1

Related Questions