Created
March 15, 2015 12:37
-
-
Save MikSDigital/1e310cf14f9515c0a0e6 to your computer and use it in GitHub Desktop.
Get pix from FLICKR and make HTML mark-up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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