-
-
Save brianleroux/59010 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<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