SHARE
TWEET

Flickr jQuery API example - full

w0lfiesmith Mar 3rd, 2013 365 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div id="flickr"></div>
  2. <script type="text/javascript">
  3. jQuery(document).ready(function($){
  4.         $.ajax({
  5.                 url: "http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
  6.                 type:"get",
  7.                 dataType:"json",
  8.                 data:{
  9.                         tags:"<?php $tagslist = get_the_tags();foreach($tagslist as $tag){echo $tag->name.",";}?>",
  10.                         tagmode:"any",
  11.                         format:"json"
  12.                 },
  13.                 success:function(data){
  14.                         $.each(data.items, function(i,item){
  15.                                 if(i==3) return false; // stop when we have 4
  16.                                 $("#flickr").append("<a href='"+item.link+"'><img style='width:33%' src='"+item.media.m+"'/></a>");
  17.                         });
  18.                 },
  19.                 error:function(message){
  20.                         alert(message);
  21.                 }
  22.         });
  23. });
  24. </script>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top