Skip to content

Instantly share code, notes, and snippets.

@johnjosephhorton
Created November 19, 2010 17:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnjosephhorton/706797 to your computer and use it in GitHub Desktop.
Save johnjosephhorton/706797 to your computer and use it in GitHub Desktop.
JSONP Cats Example
<script src="http://code.jquery.com/jquery-1.4.4.js"></script> <script>
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
{
tags: "cat",
tagmode: "any",
format: "json"
},
function(data) {
$.each(data.items, function(i,item){
$("<img/>").attr("src", item.media.m).appendTo("#images");
if ( i == 3 ) return false;
});
});
</script>
<p><style type="text/css">img{ height: 100px; float: left; }</style></p>
<div id="images">&nbsp;</div>
<p><input type="text" /></p>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment