Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <h1 style="color:rgba(53,149,225,1);">Sensor [0x48] Table</h1><br>
- <section id="dataSection">
- </section>
- <script>
- var timerTableId;
- var updateOnSecond = 10;
- function updateTableInfo(){
- var e = document.getElementById("dataSection");
- $.ajax({
- type: "POST",
- url: "php/private/getTableData.php",
- complete: function(data){
- e.innerHTML = data.responseText;
- $('#dataTable').DataTable( {
- "order": [[ 3, "desc" ]]
- } );
- }
- });
- }
- function checkIfNewMinute(){
- var d = new Date();
- var s = d.getSeconds();
- if(s == updateOnSecond){
- updateTableInfo();
- }
- }
- function init(){
- updateTableInfo();
- //timerTableId = setInterval(updateTableInfo, 1000*60);
- timerTableId = setInterval(checkIfNewMinute,1000);
- }
- window.onload = init();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement