Advertisement
showtimeiNK

Untitled

May 28th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.90 KB | None | 0 0
  1. <h1 style="color:rgba(53,149,225,1);">Sensor [0x48] Table</h1><br>
  2. <section id="dataSection">
  3.  
  4. </section>
  5.  
  6. <script>
  7.     var timerTableId;
  8.     var updateOnSecond = 10;
  9.    
  10.     function updateTableInfo(){
  11.         var e = document.getElementById("dataSection");
  12.         $.ajax({
  13.             type: "POST",
  14.             url: "php/private/getTableData.php",
  15.             complete: function(data){
  16.                 e.innerHTML = data.responseText;
  17.                 $('#dataTable').DataTable( {
  18.                     "order": [[ 3, "desc" ]]
  19.                 } );
  20.             }
  21.         });
  22.  
  23.     }
  24.        
  25.     function checkIfNewMinute(){
  26.         var d = new Date();
  27.         var s = d.getSeconds();
  28.         if(s == updateOnSecond){
  29.             updateTableInfo();
  30.         }
  31.     }
  32.  
  33.     function init(){
  34.         updateTableInfo();
  35.         //timerTableId = setInterval(updateTableInfo, 1000*60);
  36.         timerTableId = setInterval(checkIfNewMinute,1000);
  37.     }
  38.  
  39.     window.onload = init();
  40.  
  41. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement