views:

610

answers:

3

Righteo, Just started messing with Jquery, and I can update a database etc with it, but I want to know if there is a way to display new info posted into a database (even if it is not what was just posted) without a reload etc.

Don't write it out for me, just point me in the right direction... I want to pull it together myself.. best way to learn :D

A: 

The only way is to have the web page regularly poll the server for new info.

There is no way to initiate interaction from the server side.

Edit:

No way except to use a framework that handles the polling for your.

Kris
Would this be extremely bandwidth hungry?
Oliver Stubley
Yes, it would. (15)
Daniel
Right, I might have to find an alternate method. I was working with a friend of on a project a while back and I cannot remember how it was done - He did all the AJAX while i did php... Maybe he just did refreshes and fooled me o.O
Oliver Stubley
Yes, it's bandwidth heavy, so the longer you can spread out your updates, the better.
Nosredna
This need not be very bandwidth heavy. Typical usage will have polling run every 1-5 seconds at most (longer if 'immediate' notice isn't needed. A poll that finds no new data should only require a minute amount of bandwidth (the request is not probably under 1 KiB and the response is tiny).
Kris
Ah thanks Kris, I will give this a trial run and have a look how it goes, if its not that heavy then i guess it will do :D
Oliver Stubley
Nosredna
+1  A: 

Easiest solution is to poll to server periodically.

If you want the server to push to you, use Comet.

Nosredna
Thanks, I will take a look.
Oliver Stubley
A: 

You might also want to see http://stackoverflow.com/questions/136012/comet-and-jquery

Darth