How to refresh page or content in every second

21 Apr

Today,I am going to share one interesting snippet with you.You might had seen some websites which are providing live updates.Today,I will be showing you something similar to it.

HTML Code [It updates every 1 second & you can put loading image till content loading]:

<div id="content"><img alt="" src="load.gif" /></div>

Javascript Code:

<script type="text/javascript">
var auto_refresh = setInterval(
function ()
{
$('#content').load('content.php').fadeIn("fast");
}, 1);
</script>

Hope you guys like this!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s