Are you using the Livequery plugin to bind your events?  If not, then the
event binding, that presumably is setup in some other source file (other
than the HTML that's coming in via your load), won't even run against the
new code from the AJAX load.  Using Livequery will let you keep the code
separate but anytime elements that match change/come into play, it will bind
(or do whatever your Livequery handler is setup to do).

On Mon, Jul 7, 2008 at 6:54 PM, [EMAIL PROTECTED] <[EMAIL PROTECTED]>
wrote:

>
> Hi folks,
>
> I have a page with a photo on it.  I load the comments for this photo
> via an ajax request:
>
> var item_id_val = $("#item_id").val();
>
> $.post("/show_comments", item_id: item_id_val }, function(data)
> {
>    /* Update the comment_section div. */
>    $("#comment_section").html(data);
> });
>
> That works fine, but the html data that /show_comments returns doesn't
> work with jQuery.  For example, users can "thumb up" or "thumb down"
> comments, but if the html code is loaded via AJAX the .click events
> are not "binded" to that loaded data.
>
> How can I fix this problem?
>
> Any ideas or help would be greatly appreciated.
>
> Thanks,
> Konstantin
>



-- 
Chris Bailey
[EMAIL PROTECTED]

Reply via email to