Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Forked from sintaxi/index.html
Created February 5, 2009 21:13
Show Gist options
  • Save brianleroux/59010 to your computer and use it in GitHub Desktop.
Save brianleroux/59010 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>XUI Flickr Example</title>
<script type="text/javascript" src="xui.js" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
x$(window).load(function(e){
// unobtrusive add behavior to thte
x$('a.fetch-image').touchstart(function(e){
var url = "http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?";
x$("#imagebox").xhr( url, { callback:function(){
var flickrData = eval('(' + this.responseText + ')');
var str = '<img src="'+ flickrData["items"][0]["media"]["m"] + '"/>';
x$("#imagebox").html(str);
}})
});
//---
});
</script>
</head>
<body>
<a class="fetch-image">grab image from flickr</a>
<div id="imagebox">image will go here</div>
<body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment