//--------------------------------------------------------------- // Get local time //--------------------------------------------------------------- function getLocalTimeTimer() { var curDate = new Date(); //curDate.toLocaleFormat('%b-%d-%Y'); // Dec-30-2011 var localTime = curDate.toLocaleTimeString(); //document.getElementById("timeclock-server-time").innerHTML = curDate + " " + localTime; document.getElementById("timeclock-client-time").innerHTML = "Local time: " + localTime; } //--------------------------------------------------------------- // Get server time //--------------------------------------------------------------- function getServerTimeTimer() { $.ajax({ // Controller method to call //url: 'http://localhost:8080/catalog/site/build.php', url: 'lib-get-ajax-data.php', // Parameter data to pass in data: { cmd: 'get-server-time' }, type: 'POST', cache: false, dataType : "json", // Code to run if the request succeeds; // the response is passed to the function success: function(data) { // process data //console.log('data: respStatus: [' + data.respStatus + '], error: [' + data.error + '], timestamp: [' + data.timestamp + '], output: [' + data.output + ']'); var results = ''; if (data.respStatus == "ok") { results = data.output; } else { results = '
' + data.output + '' : '') + '