0

I have created a recordset to show the top 5 values in a database - this is then displayed as an include on a few pages.

Is it possible to refresh these results every few seconds without having to refresh all of the page?

3
Contributors
2
Replies
4
Views
7 Years
Discussion Span
Last Post by sergb
1

Hey,
1. One way is to use frame concepts. Your main page will have frames and in one of your frame give the src as the recordset(the file tat will display "top 5 values...").Now use the meta refresh tag

<meta http-equiv="refresh" content="3">

in the file that will generate the recordset.

2. Another way is to use AJAX (tis wont meet your exact requirement but says,,)
Make the recordset inside a div.Put a button namely "More Updates" and on clickg the button you can do the process(fetch data frm db) and display inside the same div with the help of ajax.

0

The second option suggested by Manuz should also work.

All you have to do is, instead of the "More Updates" button, call a javascript function that does the AJAX call and updates your page. This would be the same function as you would call when the "More Updates" button was clicked. But in this case the user would not need to click anything. You can schedule a function to be called periodically by using the javascript builtin function setInterval .

// Function that refreshes part of the page.
function updateTop5() {
    // make AJAX call and update page
}

// Schedule updateTop5 to be called every 5 seconds.
setInterval(updateTop5, 5000);
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.