Created
February 5, 2009 20:03
-
-
Save sintaxi/58963 to your computer and use it in GitHub Desktop.
xhr request to flickr using XUI
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> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8"> | |
<title>Page Title</title> | |
<script type="text/javascript" charset="utf-8"> | |
//paste XUI here | |
getImage = function(){ | |
x$("#imagebox").xhr("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?", | |
{callback:function(){ | |
var flickrData = eval('(' + this.responseText + ')'); | |
var str = '<img src="'+ flickrData["items"][0]["media"]["m"] + '"/>'; | |
x$("#imagebox").html(str); | |
}}) | |
} | |
</script> | |
</head> | |
<body> | |
<a src="#" ontouchstart="getImage(event);">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