Refresh Div javascript/jquery/ajax script?

Hi ,

How to refresh particular DIV every few second…

Put it in an iframe and give the head of the iframe a refresh directive.

Hi Paul,
Digging for an answer to a similar problem I have now, I found your answer.
Can you please give an example on how to do what you mentioned(iframe)?
Thanks in advance.

<iframe src="targetpage.html"></iframe>

Thanks Paul,
Can I put a php instead of html?
How do you make it refresh at a give time interval?

You would put a meta-tag in the page that the iframe is loading, to perform the refresh. See

Thank you Paul, I will do just that.

@Paul: do we really advise people to use iframes? (I’m personally not fond of iframes at all…)

iframes are not the only answer - it’s preferable now to use setInterval to trigger an ajax request, and update the div in that manner.
If using jQuery it would be something like:

$('#target').data('timedupdate', window.setInterval(function () {
}, 5000));

The data part gives you the ability to use clearInterval on that timedupdate at some later stage, should you decide you want to do so.