Reputation: 2658
I have this code into my main view file:
<html>
<head>
<script src="/app/static/js/jquery.js" type="text/javascript">
<script type="text/javascript">
jQuery(document).ready(function() {
window.setTimeout(function() {
var url = '{{=URL('monitor.load')}}';
jQuery('#monitor').load(url);
}, 10000);
});
</script>
</head>
<body>
<div id="monitor"></div>
</body>
</html>
In order to show into the #monitor div tag the data from monitor.load file:
{{=data}}
But, its put the data only once after 10 secs, then it doesn't update the data every 10 secs like I want...
if the data is changed in the controller, or is changed in the monitor.load file
nothing happens...
Upvotes: 1
Views: 523
Reputation: 68576
You should use setInterval()
instead if you want the code to occur multiple times.
Example:
setInterval("alert('hello!');", 500);
This code above will execute the code alert('hello!');
every 500 milliseconds from when the page is loaded until it is closed.
Upvotes: 4