-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdemo.html
66 lines (55 loc) · 2.23 KB
/
demo.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
<title>cachable-ajax Demo</title>
<script src="../webcomponentsjs/webcomponents.min.js"></script>
<link rel="import" href="cachable-ajax.html">
</head>
<body unresolved>
<cachable-ajax
auto
url="http://gdata.youtube.com/feeds/api/videos/"
params='{"alt":"json", "q":"chrome"}'
handleAs="json"
id="example1"
cacheResponse="false"></cachable-ajax>
<cachable-ajax
auto
url="http://gdata.youtube.com/feeds/api/videos/"
params='{"alt":"json", "q":"chrome"}'
handleAs="json"
id="example2"
cacheResponse="true"></cachable-ajax>
<cachable-ajax
auto
url="http://gdata.youtube.com/feeds/api/videos/"
params='{"alt":"json", "q":"chrome"}'
handleAs="json"
id="example3"
cacheResponse="true"
key="localStorageKey"></cachable-ajax>
<h3>Example 5 Response</h3>
<div id="example1Response"></div>
<h3>Example 2 Response</h3>
<div id="example2Response"></div>
<h3>Example 3 Response</h3>
<div id="example3Response"></div>
<script>
document.addEventListener('polymer-ready', function() {
var ajax = document.querySelector("#example1");
ajax.addEventListener("core-response", function(e) {
document.querySelector('#example1Response').innerText = e.detail.response;
});
var ajax2 = document.querySelector("#example2");
ajax2.addEventListener("core-response", function(e) {
document.querySelector('#example2Response').innerText = e.detail.response;
});
var ajax3 = document.querySelector("#example3");
ajax3.addEventListener("core-response", function(e) {
document.querySelector('#example3Response').innerText = e.detail.response;
});
});
</script>
</body>
</html>