-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
25 lines (25 loc) · 885 Bytes
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<html>
<head>
<title>Tweet Streamer</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
</head>
<body>
<h1>Tweet Stream</h1>
<ul id="tweets"></ul>
<script type="text/javascript">
var tweet_list = $("ul#tweets");
function load_tweets() {
$.getJSON("/stream", function(tweets) {
$.each(tweets, function() {
$("<li>").html(
"<img src=\"" + this.user.profile_image_url + "\" />" +
"<strong>" + this.user.screen_name + "</strong> " +
this.text).prependTo(tweet_list);
});
load_tweets();
});
}
setTimeout(load_tweets, 1000);
</script>
</body>
</html>