2011年2月12日土曜日

Starting JQuery with Twitter

Here is the first my code referencing to below URL.
http://www.atmarkit.co.jp/fwcr/rensai/ajaxrecipe01/ajaxrecipe01_1.html

Onload, this page tries to get Twitter's public_timeline with JSON format.
Then, shows  some values of the first element by JavaScript alert dialog.

<html>
<head>
  <script type="text/javascript">
    function foo(json) {
      alert(json[0].user.name);
      alert(json[0].user.location);
      alert(json[0].user.url);

    }
  </script>

  <script type="text/javascript"             
    src="http://api.twitter.com/1/statuses/public_timeline.json?callback=foo">

  </script>
</head>
<body>
</body>
</html>

* Code-Prettify (a tool for highlighting codes made by Google)
* Twitter API doc

0 件のコメント:

コメントを投稿