I have a background process that is aggregating information for me, and I would like to make it so that the web page refreshes the containing div every 10 seconds. Unfortunatley, most of the articles I am coming across are for using JS and/or ajax with forms.
I'm trying to do something more along the lines of...
<script type="text/javascript">
$(function() {
check_articles("new_articles()", 10000);
});
function new_articles(){
document.getElementById("articles").innerHTML="
<?php
$this->select_articles();
?>";
}
</script>
<div id="articles" onload="check_articles(); return false;">
Article's contents.
</div>
I really need to find the time to brush up on my JS... Anyway, the concept is there. The question is, is there a better (more effective / efficient) way to do this?
I've been up for nearly 24 hours so I'm going to play with this more tomorrow. Nonetheless, I look forward to hearing your guy's feedback and insight, as always.
Thanks.
check_articlesfunction? How does it work?check_articlesis the function referenced in the anonymous closure. Cleary, I don't write a lot of JS from scratch (I tried to make it so it didn't look like pseudo-code, lol). Anyway, I just got the Views straightened out enough to start playing around with this part, but I need to get some sleep before I dive deep. I'd appreciate any insight you might have.