views:

17

answers:

1

Hello all, I have a online user list which is populated by a SQL query to a database table.

When a new user comes online, how can i make the webpage automatically update?

What code do I need to provide? Thanks

+1  A: 

There are a few ways you could do this, but I'll avoid the most tempting WebSockets HTML5 new-ness and suggest the following:

  • When a user logs on, record the fact that they are logged on to the database.
  • From your page, poll a service or web page method that lists online users.
  • If the list changes, update the part of the page that shows the users.

That's the rough outline of what to do. If you need specifics please say what server-side host and programming language you are using. From the client side, please also mention what JavaScript framework you'd prefer or are open to.

Bernhard Hofmann
Hello bud, I already have the website fully functioning, everything working.I want it to update the userlist without a page reload!
Luke
It seems you're looking for the AJAX code to update part of the page. I'd recommend you read this article and play with the source that you can download to get to grips with it. If you're stuck after that just ping back and I'll help with specifics.http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/
Bernhard Hofmann