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?
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?
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.
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);
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.