Trying to understand how things work in OpenWrt system.
I've created new field in Luci index page:
<fieldset class="cbi-section">
<legend><%:Test Legend%></legend>">
<table width="100%" cellspacing="10">
<tr>
<td width="33%"><%:Random%></td>
<td id="rand"<%=luci.sys.exec('head -c /dev/random')%></td>
</tr>
</table>
</fieldset>
Then I try to refresh this field every 4 second:
XHR.poll(4, '<%=REQUEST_URI%>' null,
function(x, data)
{
var test = <%=luci.sys.exec('head -c /dev/random')%>;
var random = document.getElementById('rand');
random.innerHTML = test;
}
);
Result:
1. The field in an index page reloads with new random value.
2. After 4 seconds updates with another one.
3. And that's all, doesn't update every 4 seconds as expected.
Looking for a help with JavaScript, how make the process permanent.
Thanks in advance.