var url = "http://twitter.com/status/user_timeline/RedWolves.json?count=3&callback=?"; $.getJSON(url, function(data){ $.each(data, function(i, item) { $("img#profile").attr("src", item.user["profile_image_url"]); $("#tweets ul").append("" + item.text.linkify() + " " + relative_time(item.created_at) + " via " + item.source + ""); }); });
Basically what this does is pulls in the data from twitter and makes them available as objects. I then loop through each item and pull out the data I want and write it out to a unordered list. Update: make sure to look at the complete working example below as it has the two functions this code block is using (linkify and relative_time) to transform the JSON data into how I'd like it to look.
Here is the HTML stub it's going to:
You can download a working example here: twitter-json-jquery.html (1.79 KB)
with Ralph Whitbeck & Rey Bango
You can subscribe to the show in iTunes or via the raw RSS feed