Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Databases

Rifqi Fahmi
Rifqi Fahmi
23,164 Points

Refresh list of Online User for certain interval with MySql

lets figure that I want to make a social web media like facebook which user can create and log in with their account. The user can see in a navigation bar which friends are online and offline.

Is there a way to update online and offline users without refreshing the page for a certain interval such as every 10 minute it will query data from database and update the data ???

Thanks :D

1 Answer

Steven Parker
Steven Parker
220,634 Points

You can establish a function in JavaScript that will be performed on a particular interval. In this function, you can do an AJAX server request that will fetch the desired data and update only those fields on the page where the data are being displayed.

There are courses here covering:

I believe these are both parts of the Full Stack JavaScript track.

Rifqi Fahmi
Rifqi Fahmi
23,164 Points

Thanks i will look for it :D