I have a solution that was written with a minimalist, basic AJAX file.  I
would love to upgrade to jQuery, but I'm still such a newbie that my brain
isn't functioning.

I have a list of photos returned from my database with dynamic loop
counting.  Each row is currently this:

<div id="photo[loop_count]" class="Text2" >
<input name="photo" type="hidden" value="[field: 'ID']" />
<a href="#" title="Remove this Photo" onclick="return
rmPhoto('process.lasso?[field: 'ID']', 'photo[loop_count]', '[loop_count -
1]');"><img src="/apps/photos/images/delete.gif" width="19"
height="19"border="0" align="middle" /></a></div>

That onclick function is passing page that needs to do the processing, the
div ID (where it's going to display the response message), and the current
loop count - 1 to set the value of the hidden field.

It calls this function:

function rmPhoto(data, message, loop){
    if (confirm("Are you sure you want to delete this photo?")){
        if(!document.album.photo.length > 0)
            document.album.photo[loop].value = 0;
        else
            document.album.photo.value = 0;
        processData('/apps/photos/runtime.lasso', data, message);
    }
    return false;
}

processData is basic AJAX function to call the file, pass the data, and
return info to the div to display.

So, I'll need to find all divs with class "Text2"
    find the a tag within that div
        bind a click function to that a tag
            which will:
             do a load to that div - this I believe will obliterate any all
items in the div, which is actually fine because when the main form is
processed, I would need information about a deleted photo anyway.

Any help in writing this in jQuery would be appreciated.

[Shelane]


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to