I have written a code to refresh two divs at regular intervals of time. Here it is
<script language="javascript">
$(document).ready(function() {
$("#autorefresh_1").load("content1.php");
var refreshId = setInterval(function() {
$("#autorefresh_1").load("content1.php");
}, 9000);
$("#autorefresh_2").load("content2.php");
var refreshId = setInterval(function() {
$("#autorefresh_2").load("content2.php");
}, 9000);
});
</script>
Is there some other best way of writing this code? prehaps merging the two? Sorry for the simple question, I am new to jQuery.
I would do it like so: