In an htm file (simple testcase):
<fieldset class="cbi-section">
<legend><%:Test Legend%></legend>
<div class="table" width="100%" cellspacing="10">
<div class="tr">
<div class="td" width="33%"><%:Random%></div>
<div class="td" id="rand">0</div>
</div>
</div>
</fieldset>
<script type="text/javascript">//<![CDATA[
XHR.poll(4, '<%=REQUEST_URI%>', null,
function(x, data)
{
var test = <%= luci.http.write_json(luci.sys.exec('date -D hh:mm:ss')) %>;
var random = document.getElementById('rand');
random.innerHTML = test;
}
);
//]]></script>
I am polling for time every 4 seconds. On initial page load, time is zero (initial value). First XHR poll time updates. Second and subsequent polls, time does not change.
What am I missing?
Thanks;
Bill