Skip to content

Instantly share code, notes, and snippets.

@sintaxi
Created February 5, 2009 20:03
Show Gist options
  • Save sintaxi/58963 to your computer and use it in GitHub Desktop.
Save sintaxi/58963 to your computer and use it in GitHub Desktop.
xhr request to flickr using XUI
<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