The classic example for understanding jQuery $.getJSON (and JSON format).
Taken from jQuery documentation.
This code displays images of cats from flickr.
Taken from jQuery documentation.
This code displays images of cats from flickr.
<!DOCTYPE html>
<html>
<head>
<style>img{ height: 100px; float: left; }</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<div id="images">
</div>
<script>
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
{
tags: "cat",
tagmode: "any",
format: "json"
},
function(data) {
$.each(data.items, function(i,item){
$("<img/>").attr("src", item.media.m).appendTo("#images");
if ( i == 3 ) return false;
});
});</script>
</body>
</html>
further on JSON is available on jQuery documentation and on twitter api documentation
ReplyDeletehttp://search.twitter.com/api/
http://api.jquery.com/jQuery.getJSON/
http://docs.jquery.com/Getjson