Note that there are some explanatory texts on larger screens.

plurals
  1. POgetting server time by Ajax - what is wrong with my code?
    text
    copied!<p>I made a button that is when pressed it brings the server time ,,,so there is this html and js file and I want it to get time from time.tcl file , please assist me with it :</p> <p>1.my file using html and Javascript :</p> <pre><code> &lt;html&gt; &lt;body&gt; &lt;input value="Get Time" type="button" onclick='JavaScript:showCurrentTime()' name="GetTime"&gt; &lt;div id="result" align="center"&gt;&lt;/div&gt; &lt;script language="Javascript"&gt; function showCurrentTime() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject(“Microsoft.XMLHTTP”); } var xmlhttp; 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 &amp;&amp; xmlhttp.status==200) { document.getElementById("result").innerHTML=xmlhttp.responseText; } xmlhttp.open(“GET”,”time.tcl”,true); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>2.my time.tcl file :</p> <pre><code> set now [clock seconds] # print default-formatted time puts [clock format $now] # print custom formatted time set fmt "Today is day %j of the current year." puts [clock format $now -format $fmt] set today [clock seconds] set fmt "%Y-%m-%d" puts "The current date is [clock format $today -format $fmt]." </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload