Forum Moderators: open
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=dog&tagmode=any&format=json&jsoncallback=?",
function(data){
$.each(data.items, function(i,item){
$("<img/>").attr("src", item.media.m).appendTo("#images");
if ( i == 9 ) return false;
});
});
});
</script>
<div id="images"></div>
There's no way for the API to notify your site when a new photo is available. How pretty much all AJAX implementations deal with this limitation is by "polling" the data source every so often to see if there is new information.
I'm sure jQuery has some built in functions to make this easier, but I'm not familiar with that library. In plain Javascript, you'd use setTimeout() to set up a function that fires every few seconds/minutes.