abe6fdbfaa6bef087f4128ec4b7515115e8e708a
[packages/precise/mcollective.git] / lib / mcollective / vendor / json / data / index.html
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2         "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
4   <head>
5     <title>Javascript Example</title>
6     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>    
7     <script src="prototype.js" type="text/javascript"></script>
8   </head>
9
10   <body>
11     <h1>Fetching object from server</h1>
12     <div id="list">
13       Wait...<br/>
14       <noscript><p>Switch on Javascript!</p></noscript>
15     </div>
16     <script type="text/javascript">
17     <!--
18     function pollJSON() {
19       new Ajax.Request('/json',
20         {
21           method: 'get',
22           onSuccess: function(transport) {
23             var response = transport.responseText || "no response text";
24             response = eval("(" + response + ")");
25             var text = "";
26             for (var k in response) {
27               text = text + "<b>" + k + "</b>: " + response[k] + "<br/>"
28             }
29             $("list").update(text);
30           },
31           onFailure: function() { alert('Something went wrong...') }
32         });
33     }
34     new PeriodicalExecuter(pollJSON, 1);
35     -->
36     </script>
37   </body>
38 </html>