Avatar of Bill Sullivan
Bill Sullivan
Flag for United States of America asked on

Refresh a portion of a page every 10 seconds

Hi Experts!
I'm trying to get some customer testimonials to "scroll" on the front page of my website by calling survey results from my database.  I would like these comments to scroll every 10 seconds.  Can you help me with the code to do this?  I've included the page I'm working on, and the lines I would like to refresh are found on lines 121 through 165.  Thanks for your help!
index.php
HTMLjQuery

Avatar of undefined
Last Comment
Bill Sullivan

8/22/2022 - Mon
Daniel Kline

Use a JavaScript setTimeout() function to wrap the render code which selects the content to display during each interval.

https://developer.mozilla.org/en-US/docs/Web/API/Window.setTimeout
Bill Sullivan

ASKER
It appears that code would delay running the script for X seconds, but would not "refresh".  Am I missing how setTimeout() works?
ASKER CERTIFIED SOLUTION
Gary

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Daniel Kline

There are a lot of discussions on the Internet in how to use setTimeout and its sister setInterval.  The application you are describing is quite common.  See if this solves your problem without having to deal with recursive calls to setTimeout.

http://manos.malihu.gr/slidebox-jquery-banner-rotator/
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Bill Sullivan

ASKER
Thank you so much!