Last active
August 29, 2015 14:15
-
-
Save acrogenesis/60368b9c504ba15ed72a to your computer and use it in GitHub Desktop.
Revisions
-
acrogenesis revised this gist
Feb 12, 2015 . 1 changed file with 44 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,44 @@ <html> <head> <title>Timestamp</title> </head> <script> var myTimer; function getTime(){ var xmlhttp; var span; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { p = document.createElement("p"); p.innerText = xmlhttp.responseText document.getElementById("timestamps").appendChild(p); } } xmlhttp.open("GET","http://localhost:4567/",true); xmlhttp.send(); } function startGetTime(){ getTime(); myTimer = setInterval(function(){ getTime(); }, 20000); } function stopGetTime(){ clearInterval(myTimer); } </script> <body> <button name="button" onclick="startGetTime();">Start</button> <button name="button" onclick="stopGetTime();">Stop</button> <div id="timestamps"> </div> </body> </html> -
acrogenesis created this gist
Feb 9, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ require 'sinatra' get '/' do response['Access-Control-Allow-Origin'] = '*' Time.now.to_s end