View Full Version : Refresh the Ajax Tabs Content

01-19-2007, 11:39 AM
1) Script Title: Ajax Tabs Content script

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/

3) Describe problem:
Hi i have download this script, i have a request/problem, there's a method to refresh the TAB?
I have on the Tab, the status of user online of a chat (the content of tab is asp), and i want to refresh every 1 or 2 minutes or when a user entry to chat.
It's possible? :confused:
Thaks so Much

05-21-2007, 01:42 PM
I too would like to know the answer to this. :)

06-20-2007, 02:16 PM
I've been trying to do the same thing. I can refresh the tab contents by setting rev= in each tab to a script that does this:

var seconds = 10; // seconds to wait before refreshing
var timerId = 0;

onload = function(){
timerId = setInterval('location.reload(true)', seconds*1000);

However, if I click on a tab that's not the default one (class="selected"), it will refresh back to the default one. I tried adding onunload(clearInterval(timerId)) to the above script, but that doesn't work.

I also tried to do this inside the ajaxtabs script (the first line was original to the script, the setInterval is my addition) after removing the rev= references above, but no refreshing happens:
loadpage(page_request, containerid);
setInterval('loadpage(page_request, containerid)', 10000);

Any ideas?

06-21-2007, 04:57 AM
The built in function:

expandtab('maintab', 2)

lets you select a particular tab and its content when called, in this case, the second tab. So to refresh a tab periodically, you can do something like:

setInterval(function(){expandtab('maintab', 2)}, 3000)

This would refresh the second tab every 3 seconds.

02-03-2009, 06:58 AM
Could you please explain how to implement that code to automatically refresh tabs?

02-04-2009, 04:27 AM
You'll have to be more specific willsko87. The code above already will automatically refresh a particular tab every x seconds.