Use of setInterval function
just alert “Naru” to test this function
setInterval( "alert('Hello Naru')", 5000 ); ///////// 5 seconds
Example : With jquery,update div contents after 5 seconds
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script>
<script language="JavaScript">
setInterval( "SANAjax();", 5000 ); ///////// 10 seconds
$(function() {
SANAjax = function(){
$('selector').prepend("Hi This is auto refresh example for you - w3cgallery.com <br><br>").fadeIn("slow");
}
});
</script>
Friday, 13 July 2012
How to Ajax auto refresh after x seconds
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment