XHR.poll formvalue not updating

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

Further info: Not just a refresh issue.

I added alert(test) to examine time. It doesn't change. So, something wrong with:

var test = <%= luci.http.write_json(luci.sys.exec('date -D hh:mm:ss')) %>;

same behavior (constant data) using os.date() and math.random(10)

WTF?

The code in <% %> is evaluated once on the server side and then never changed again. Inspect the source view of your browser to see the problem.