There's actually a jQuery plugin for what you're doing...it's called
jHeartbeat. It periodically pings the server to keep a connection alive, but
I'm sure it could also perform other actions.

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Angelo Zanetti
Sent: Thursday, September 06, 2007 10:59 AM
To: jquery-en@googlegroups.com
Subject: [jQuery] show new image in gallery


Hi all

This is more of a general question but is linked to JQuery.

Here is the scenario:

I have an image gallery and while users are viewing the gallery a new image
is added. I want to be able to dynamically show the new image to the user if
they are on the last page.
So basically my thoughts on how it will work are as follows:

every few seconds an XMLHttpRequest will be made to the server to check if
there are any new images (that functionality doesnt need to be discussed
here).
If there is a new image the response will indicate that.

Now how would I show the image in the gallery? Say its a table and there is
an open <td> for example? Im sure I can place a <div> in the <td> and an
<img> in the div and populate that with the src but Im not sure if the image
will display?

Is there something wrong with my logic? or is there another way to do this?

I have been going through:

http://ajaxpatterns.org/Periodic_Refresh

I'd appreciate any comments and help.

Thanks in advance.
--
------------------------------------------------------------------------
Angelo Zanetti
Systems developer
------------------------------------------------------------------------

*Telephone:* +27 (021) 552 9799
*Mobile:*       +27 (0) 72 441 3355
*Fax:*            +27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>



Reply via email to