Auto Load and Refresh Div with jQuery in every 10 seconds

Sometimes you need to refresh a DIV area in each 5-10 seconds to show most latest data as you have seen in Facebook and Twitter which shows latest updates at top.

Index.html

<script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/
libs/jquery/1.3.0/jquery.min.js”></script>
<script type=”text/javascript”>
var auto_refresh = setInterval(
function ()
{
$(‘#load_tweets’).load(‘record.php’).fadeIn(“slow”);
}, 10000); // refresh every 10000 milliseconds

<body>
<div id=”load_tweets”> </div>
</body>

</script>

record.php

<?php
echo “Deepanker verma”;
?>

This code will refresh div in every 10 seconds and you will show flashing Deepanker Verma. You can change the content as per your need. In the PHP code.

Additional Reading:

Create Countdown Timer With jQuery

Expandable Tree Navigation With Treeview, jQuery Plugin

advertisement

About The Author

    ADD YOUR COMMENT

Subscribe To Our Newsletter

Subscribe To Our Newsletter

Receive fresh web design resources and SEO tips in your email by our weekly newsletter

You have Successfully Subscribed!