How do I refresh just a portion of a webpage using ajax?

I need a script that refreshes a portion (not the entire page) of a webpage every x-seconds. Could anyone recommend one or post a snippet that does such?
I don't want to use i-frames, I prefer AJAX or something similar.
 
Use a timer, query a seperate page on your site, the page will produce a return string or whatever it is you are refreshing, and return that value to the current page.
 
use timer, update panel and update progress to display some thing to user. place you code in update panel and set the timer control. this should work
 
I did it by putting the part that needs to be refreshed in a separate page, fileName.asp in this example.

function callServer() {
var head = document.getElementsByTagName('head').item(0);
var scriptTag = document.getElementById('loadScript');
if (scriptTag) head.removeChild(scriptTag);
script = document.createElement('script');
script.src = 'fileName.asp';
script.type = 'text/javascript';
script.id = 'loadScript';
head.appendChild(script);
}
setInterval(callServer, 5000);

Don't forget to put callServer() into the Body tag as an "OnLoad" statement to get it running.
 
Back
Top