Skip to content

Instantly share code, notes, and snippets.

@MikSDigital
Created March 15, 2015 12:37
Show Gist options
  • Save MikSDigital/1e310cf14f9515c0a0e6 to your computer and use it in GitHub Desktop.
Save MikSDigital/1e310cf14f9515c0a0e6 to your computer and use it in GitHub Desktop.
Get pix from FLICKR and make HTML mark-up
jQuery(function($){
$.ajax({
type: 'GET',
url: 'http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?',
data: {
tags: "cats",
//tagmode: "any",
format: "json",
//sort: "random"
},
dataType: 'jsonp',
crossDomain: true,
}).done(function(data){
console.log(data);
$.each(data.items, function(i,item){
$("<img/>")
.attr("src", item.media.m)
.appendTo(".cube")
.wrap("<a target='_blank' href='" + item.link + "'>");
if ( i == 5 ) return false;
});
}).fail(function(error){
console.log(error.statusText);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment