Commits

Alexander Dahl committed 80d1640 Draft

get time from php server

  • Participants
  • Parent commits aa809d4

Comments (0)

Files changed (3)

     </div>
 
     <h4>Congratulations to all our finishers!</h4>
+    <p id="freq"></p>
     <p>Last Updated: <em id="updatedTime"></em></p>
 
     <script src="scripts/jquery-1.6.4.min.js" type="text/javascript"></script>

scripts/page295.js

+var FREQ = 10000;
+
 function getTime(){
     var a_p = "";
     var d = new Date();
     $('#updatedTime').html(curr_hour + ":" + curr_min + ":" + curr_sec + " " + a_p );
 }
 
+function getTimeAjax() {
+    $('#updatedTime').load( "time.php" );
+}
+
 function getXMLRacers() {
     $.ajax({
         url:        "page295/finishers.xml",
                 $('#finishers_all').append(info);
             });
 
-            getTime();
+            getTimeAjax();
         }
     });
 }
 
+function showFrequency() {
+    $("#freq").html( "Page refreshes every " + FREQ/1000 + " second(s)." );
+}
+
 function startAJAXcalls() {
-    var FREQ = 10000;
     setTimeout( function() {
             getXMLRacers();
             startAJAXcalls();
 }
 
 jQuery(document).ready(function(){
+    showFrequency();
     getXMLRacers();
     startAJAXcalls();
 });
+<?php
+    date_default_timezone_set('America/Los_Angeles');
+    echo date( "F j, Y, g:i:s a" );
+?>