1

I'm working on a comment system and I need to show the comment after it's posted, without reloading the page, which works just fine. The problem is, that the comment is writtin in a textarea.

What I want:

"This is my comment

Best regards,
Morten"

What I'm getting:

"This is my comment.Best regards, Morten"

CODE:

$(document).ready(function(){
    $('.AnswerPQSubmit').click(function() {
        dataString = $(this).parent().serialize();
        var pqid = $(this).parent("form").find(".pqid").val();
        var answerpq = $(this).parent("form").find(".answerpq").val();
        $.ajax({
          type: 'post',
          url: 'postpqanswer.php',
          data: dataString,
          dataType: 'html',
            success: function(data) {
                $('.span'+pqid).append('<p>'+answerpq+'</p>');
            }
         });
        return false;
    });
});

I have searched around, but I can't seem to find a solution.

Thank you.

Niels Hermann
  • 611
  • 2
  • 6
  • 13

0 Answers0