Custom HTML template, how to refresh data Topic is solved

Topics (not sure which fora)
when not sure where to post, post here and mods will move it to right forum.

Moderators: leecollings, remb0

Post Reply
zicht
Posts: 300
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Custom HTML template, how to refresh data

Post by zicht »

Hi,

I populate a html page in tab custom with lua

Code: Select all

	WriteToFile('<table border="1"><col width="33%"><col width="25%"><col width="32%"><tr><td style="vertical-align:top">'..content..'</td><td style="vertical-align:top">'..weekoverzicht.."</td><td style='vertical-align:top'>"..data.."</td></tr></table>","CustomHTML")
This works great and i have a dynamic custom page with data.
The only problem is how to use HTML code to refresh the table lets day once in 5 minutes

HTML refresh commands cannot been used as it refreshes domoticz as well.
The trick should be in jquery but i have no clue how to start. I tried things by placing the table in a div, but it never refreshes. And then trying to refresh the div.

This snipplet i found on internet, but i have no clue how to adjust

Code: Select all

$.ajax({
  //other options
  success:function(){
       commentContainer.slideUp('slow', function() {$(this).remove();});
       $('#otherdiv').load('urlofpagewith info.html');
  }

 });
Does anybody have the skills and is willing to help to get some jquiry around it ?
Any suggestion is appriciated.
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
zicht
Posts: 300
Joined: Sunday 11 May 2014 11:09
Target OS: Windows
Domoticz version: 2023.1+
Location: NL
Contact:

Re: Custom HTML template, how to refresh data

Post by zicht »

Found it finaly content.txt contains the file i compose with lua.
i have made a html page in templates dir that has the below code, it refreshes every minute (60000)
now i can build from that :)

Code: Select all

<div id="mytableHolder">test</div>
<script type="text/javascript">
    $(document).ready(function(){
      refreshTable();
    });

    function refreshTable(){
        $('#mytableHolder').load('/templates/content.txt', function(){
           setTimeout(refreshTable, 60000);
        });
    }
</script>
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest