Your Ad Here

Posted By

eddequincey on 02/17/11


Tagged

jquery json twitter


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

Some0ne
sethetter
jondiscipulo
Balamir


Get a tweet from user timeline using JSON and jQuery


 / Published in: jQuery
 

  1. <html>
  2. <head>
  3. <title>JSON Example</title>
  4. <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
  5. <script type="text/javascript">
  6. function getTweet(){
  7. $.getJSON("http://twitter.com/status/user_timeline/uniofgreenwich.json?count=1&callback=?",
  8. function(data){
  9. $("#twitter").html("<a href='http://twitter.com/#!/uniofgreenwich/status/"+data[0].id_str+"'>" + data[0].text + "</a>");
  10. });
  11. }
  12.  
  13. $(document).ready(function(){
  14. getTweet();
  15. });
  16. </script>
  17. </head>
  18. <body>
  19. <p id="twitter"></p>
  20. </body>
  21. </html>

Report this snippet  

You need to login to post a comment.