I found most of this on a tutorial but I have added to it.
<!DOCTYPE html>
<html>
<head>
<title>JQUery get tweets</title>
<style>
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
var params = $("#tweets").attr("rel");
params = params.split("|");
username = params[0];
count = params[1];
var format='json';
var url='http://api.twitter.com/1/statuses/user_timeline/'+username+'.'+format+'?callback=?';
$.getJSON(url,function(tweet){
var tweets='<ul>';
for (i=0;i<=count;i++){
tweets+= "<li>" + (tweet[i].text) + "</li>";
}
tweets+= "</ul>";
var start = tweets.indexOf("http");
var end = tweets.indexOf(" ", start);
var len = end - start;
var link = tweets.substr(start,len)
console.log(start + " " + end + " " + link);
$("#tweets").html(tweets);
});
});
</script>
</head>
<body>
<div id="tweets" rel="smileyhcoder|5"></div>
</body>
</html>
Not sure if it’s better to loop through the end result or to replace during each occurrence of the for loop. In either case there could and will be multiple links.