Created
December 15, 2010 06:01
-
-
Save jasonkarns/741683 to your computer and use it in GitHub Desktop.
Sample YQL demo
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
<html> | |
<head> | |
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> | |
<title>YQL</title> | |
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script> | |
<script type="text/javascript"> | |
//<![CDATA[ | |
(function($){ | |
flickr_handler1 = function(data){ | |
var photos = []; | |
$.each(data.query.results.photo, function(index, value){ | |
var src = "http://farm"+ this.farm +".static.flickr.com/"+ this.server +"/"+ this.id +"_"+ this.secret +"_s.jpg"; | |
photos.push('<li><a href="'+ this.urls.url +'"><img src="'+ src +'" alt="'+ this.title +'" /></a></li>'); | |
}); | |
$("<ul/>").append(photos.join("")).insertAfter("#native"); | |
}; | |
flickr_handler2 = function(data){ | |
var photos = []; | |
$.each(data.query.results.ul.li, function(index, value){ | |
photos.push('<li><a href="'+ this.a.href +'"><img src="'+ this.a.img.src +'" alt="'+ this.a.img.alt +'" /></a></li>'); | |
}); | |
$("<ul/>").append(photos.join("")).insertAfter("#custom"); | |
}; | |
})(jQuery); | |
//]]> | |
</script> | |
</head> | |
<body> | |
<h1 id="native">Native</h1> | |
<h1 id="custom">Custom</h1> | |
<!-- Wrapped http://y.ahoo.it//MJFd41c --> | |
<script type="text/javascript" src="http://query.yahooapis.com/v1/public/yql?q=use%20%22http%3A%2F%2Fgithub.com%2Fcodepo8%2Fyql-tables%2Fraw%2Fmaster%2Fflickr%2Fflickr.photolist.xml%22%20as%20flickr%3B%20select%20*%20from%20flickr%20where%20text%3D%22ohio%20state%20football%22%20and%20amount%3D10&format=json&callback=flickr_handler2"></script> | |
<!-- Native http://y.ahoo.it/h2k8BxvH --> | |
<script type="text/javascript" src="http://query.yahooapis.com/v1/public/yql?q=select%20farm%2Cid%2Csecret%2Cowner.realname%2Cserver%2Ctitle%2Curls.url.content%20from%20flickr.photos.info%20where%20photo_id%20in%20(select%20id%20from%20flickr.photos.search(10)%20where%20text%3D%22ohio%20state%20football%22%20and%20license%3D4)%0A&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=flickr_handler1"></script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment