Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. <script>
  2. var xmlHttp, srvTime, thisDay;
  3. function getSrvTime() {
  4. try {
  5. xmlHttp = new XMLHttpRequest();
  6. }
  7. catch (err1) {
  8. try {
  9. xmlHttp = new ActiveXObject('Msxml2.XMLHTTP');
  10. }
  11. catch (err2) {
  12. try {
  13. xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
  14. }
  15. catch (eerr3) {
  16. // Browser didn't support ajax so use client time
  17. return new Date();
  18. }
  19. }
  20. }
  21. xmlHttp.open('HEAD', window.location.href.toString(), false);
  22. xmlHttp.setRequestHeader("Content-Type", "text/html");
  23. xmlHttp.send('');
  24. return xmlHttp.getResponseHeader("Date");
  25. }
  26.  
  27. function updateSchedule() {
  28. jQuery("#schedule").load(location.href + " #schedule");
  29. }
  30.  
  31. (function($, window){
  32. $(function(){
  33. // get server time on init
  34. var now = new Date(getSrvTime());
  35.  
  36. // set thisDay to the current day
  37. thisDay = now.getDay();
  38.  
  39. // set the interval for polling (every 30 seconds
  40. setInterval(function() {
  41. updateSchedule();
  42. }, 30000);
  43. });
  44. })(jQuery, window);
  45. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement