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">
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>
11 <h1>Fetching object from server</h1>
14 <noscript><p>Switch on Javascript!</p></noscript>
16 <script type="text/javascript">
19 new Ajax.Request('/json',
22 onSuccess: function(transport) {
23 var response = transport.responseText || "no response text";
24 response = eval("(" + response + ")");
26 for (var k in response) {
27 text = text + "<b>" + k + "</b>: " + response[k] + "<br/>"
29 $("list").update(text);
31 onFailure: function() { alert('Something went wrong...') }
34 new PeriodicalExecuter(pollJSON, 1);