Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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
229,744 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