Pow run ajax
From PlainOldWebserver
pow_run_ajax()
Helper function to add XMLHttpRequest object and run XHR commands. This example changes "Text to change" below with the date. Because of needed headers from pow_run_ajax(), the SJS code should precede all HTML.
<?sjs
pow_server.put_text = function() {
var date = new Date();
var time = date.getSeconds();
var changetext = new Array('changeme', time);
return changetext;
}
pow_run_ajax();
?>
<form onsubmit="pow_ajax_load('http://localhost:6670/test.sjs?AJAX=true');
return false;" action="#" method='GET' >
<input type='submit' value='Go' />
</form>
<div id="changeme">Text to change</div>
</body>
</html>
