views:

95

answers:

0

By this code I add comments to a posts. But there is a problem - the first comment work, but i am not able to add next. I use livequery, so it shold work. Can you help me?

$('form.comment_form').livequery('submit', function a()  
  {
      var element = $(this);        
      var wall_post_id = element.attr("id");
       var wall_message = $('#comment_text'+wall_post_id).attr('value');

        $.post("home/add_comment", $(this).serialize(), function(response)
        {
            if(response.error == "0")
            {
          $("div#comments"+wall_post_id).replaceWith(response.message);
            }
            else if(response.error == "1")
            {
               alert(response.message);
               return false;
            }
      }, "json");
      return false;
   });