Thanks I will check this out!

Seems like im on the correct track then.

Will update this posting to let others know how I progressed!


Benjamin Sterling wrote:
Angelo,
That would be how I would do it and all you need to add to the list depends on a few things:

You may want to do something like:

//inside you ajax
if(THERE IS NEW IMAGE){
var td = $('<td>').appendTo('table');  // or prependTo('table');
// maybe append a notice that a new image is loading
var newsrc = imageUrl;
var newimage = new Image();
newimage.onload  = function(){
td.empty().append(this);
}
newimage.src = newsrc;

}
Of course that is not tested, but I did something similar in another project.

On 9/6/07, *Angelo Zanetti* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:


    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]>
    <mailto:[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> >





--
Benjamin Sterling
http://www.KenzoMedia.com
http://www.KenzoHosting.com <http://www.KenzoHosting.com>

--
------------------------------------------------------------------------
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