What I ended up doing was setting a variable and testing for it. If it's set, then I just toggle the display instead of grabbing the data via AJAX.
On Jul 8, 1:19 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi folks, > > I have a page with a photo and comments on it. I load the replies to > the comments for this photo via an AJAX request like so (I also use > LiveQuery): > > JavaScript: > /* Show Replies button action. */ > $(".show_replies").livequery('click', function() > { > var photo_id_val = $("#photo_id").val(); > var comment_id_val = $(this).attr("id"); > > $.post("/show_comments", { photo_id: photo_id_val, comment_id: > comment_id_val }, function(data) > { > /* Update the div that holds the replies. */ > $("#replies_for_"+comment_id_val).html(data); > $("#replies_for_"+comment_id_val).slideToggle(); > }); > > }); > > HTML: > <span id="c4" class="show_replies" title="Show the Replies">Show > Replies</span> > <div id="replies_for_c4"></div> > > So everytime I click on "Show Replies" span, it would load up the > replies via AJAX and slide them in and out. This works fine. > > My question is the following: > Is it possible to load the replies ONCE and just slideToggle them, > instead of loading them via AJAX every time the "Show Replies" is > clicked? > > Any ideas or help would be greatly appreciated. > > Thanks, > Konstantin