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

Reply via email to