-
Notifications
You must be signed in to change notification settings - Fork 2
/
index.html
37 lines (32 loc) · 1.32 KB
/
index.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
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html>
<head>
<title>rest.js example</title>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<script type="text/javascript" src="rest-min.js"></script>
</head>
<body>
<h1>rest.js examples</h1>
Everything you see on this page (except for this message) is dynamically loaded from REST-APIs and webpages with <a href="http://github.com/ippa/rest.js">rest.js</a>
</body>
<script>
var body = document.getElementsByTagName("body")[0]
restjs.get("http://twitter.com/status/user_timeline/ippalix.json?count=10", function(data) {
body.innerHTML += "<h2>10 latest tweets from ippalix</h2>"
data.forEach( function(tweet) {
body.innerHTML += "- " + tweet.text + "<br />"
});
});
restjs.get("http://www.flickr.com/services/feeds/photos_public.gne?format=json", function(data) {
body.innerHTML += "<h2>Using the Flickr API</h2>"
data["items"].forEach( function(item, total) {
body.innerHTML += '<a href="' + item["link"] + '">' + '<img src="' + item["media"]["m"] + '" /></a>'
});
});
restjs.useJSON();
restjs.get("http://ippa.se/restjs/rest.js", function(data) {
body.innerHTML += "<h2>rest.js source code</h2>"
body.innerHTML += data
});
</script>
</html>