LastTweet

by Tgwizman

HTML

<user>Loading...</user><br>
<lasttweet></lasttweet>

JavaScript

user = function() {
    if (document.location.href.split("?")[1]) {
        return document.location.href.split("?")[1];
    } else {
        return false;
    }
}

jQuery.getJSON("http://search.twitter.com/search.json?callback=?",{
    q: user()
},function(tweets) {
    if (user()) {
        $("user").html(tweets.results[0].from_user + "'s last said:")
        $("lasttweet").html('"' + tweets.results[0].text + '"');
    } else {
        $("user").html("Error!!! D:");
        $("lasttweet").html("No data loaded!");
    }
});