Display user tweets using java script and jQuery

Guys here is a very simple example of fetching user tweets

it uses user timeline to get the tweets.

There are lots of other properties which you can use I just used text and profile image url

look at the getTweet function and change its arguments as needed.

Here it goes

    <title>JSON Example</title>
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
    <script type="text/javascript">
        function getTweet(username, howMany) {
            $.getJSON("http://twitter.com/status/user_timeline/" + username + ".json?count=" + howMany + "&callback=?",
        function (data) {
            var count = data.length;
            while (count– > 0) {
                $("#twitter").append("<div> <img src=’" + data[count].user.profile_image_url + "’/>" + data[count].text + "<div><br/>");

        $(document).ready(function () {
            getTweet(‘tarunjuneja’, 50);
    <p id="twitter">


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s