TwitterLinkedInRSS

Pulling twitter updates with JSON and jQuery

I wrote a little script tonight to pull in my latest 3 tweets from twitter and display them on my blog.

Here is how I did it. I used the Twitter’s API and called my time line with a JSON call and consumed it with jQuery and outputted it to a blank div.

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:

Source

  • http://www.facebook.com/doris.pelger Doris Pelger

    Ralph,
    Thank you for sharing this!
    Works great and comes just in time!

    • http://ralphwhitbeck.com/ Ralph Whitbeck

      No problem Doris. Glad you found this useful.

  • Pingback: Ralph Whitbeck – jQuery Conference 2009 – Summary

  • http://www.jonathancarling.co.uk/ Jonathan Carling

    I’ve recent had to upgrade my company’s use of the Twitter API from v1.0 to v1.1. Your post was a massive help to get me quickly up to speed with the JSON side to fix one of our custom Twitter widgets. Thanks for the help!

  • Colin

    Thanks for this Ralph