Created
June 23, 2011 05:49
-
-
Save liquorice/1041979 to your computer and use it in GitHub Desktop.
bare bones method for grabbing and updating a users latest tweet (with no error handling whatsoever)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.ajax({ | |
url: 'http://api.twitter.com/1/statuses/user_timeline.json?screen_name=someonesplendid', | |
dataType: 'jsonp', | |
success: function(data) { | |
var tweet = data[0].text; | |
tweet = tweet.replace(/(http\:\/\/[A-Za-z0-9\.\/_]+)/g, '<a href="$1">$1</a>'); | |
tweet = tweet.replace(/@([a-zA-Z0-9_]+)/g, '<a href="http://twitter.com/$1">@$1</a>'); | |
$('#tweet').html(tweet); | |
} | |
}); |
so it does! i missed that out when i moved the callback function inline. fixed, thanks max.
FYI: Am using it on http://swipeconference.com.au/ with a little addition for pulling out the time and formatting relative to now.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Works great, but needs the
data
parameter in the callback.