PHP MySQL错误

I am creating a comment post system that allow users to write comments using php mysql jquery and ajax and using Json but the problem that I get when I insert Json and I debug the system using firedebug I get the error message : SyntaxError: JSON.parse: unexpected character can anyone help me with this error

this is the code @line 42 I use Json

$(document).ready(function() {
//this will fire whene the page will completly been loaded 
$('#comment-post-btn').click(function(){

     comment_post_btn_click();
    });
});

function comment_post_btn_click()
{
// text within the text area
  var _comment = $('#comment-post-text').val();
  var _userId = $('#userId').val();
  var _userName = $('#userName').val();


  if(_comment.length > 0 && _userId != null )
  {
      // proceed with the ajax callback
      $('#comment-post-text').css('border', '1px solid #e1e1e1');

        $.post("ajax/comment_insert.php",
           {
             task : "comment_insert",
             userId :_userId,
             comment :_comment
           }
           )

            .error(

                   function(data)
                   {
                      console.log("Error" );

                   })

                .success(

                    function(data)
                   {
                      comment_insert(jQuery.parseJSON(data));
                      console.log("Response text:  " + data )
                   }
           );
     console.log(_comment + " UserName: " +  _userName  + " User id: " + _userId );
  }
  else
  {
      $('#comment-post-text').css('border', '1px solid #ff0000');
      console.log("the text area was empty");
  }


   // remove the text from the textarea
   $('#comment-post-text').val("");

}

function comment_insert(data)
{
    var t = '';
t+= '<li class="comment-holder" id="'+data.comment_id+'">';
t+=     '<div class="user-img">';
t+=         '<img src="'+data.profile_img+'" class="user-img-pic" />';
t+=     '</div>';
t+=  '<div class="comment-body">';
t+=     '<h3 class="username-field">'+data.userName+'</h3>';
t+=      '<div class="comment-text">'+data.comment+'</div>';
t+=  '</div>';

t+=  '<div class="comment-buttons-holder">';
t+=         '<ul>';
t+=            '<li class="delete-btn">X</li>';
t+=          '</ul>';
t+=  '</div>';
t+='</li>';

$('.comments-holder-ul').prepend(t);
}

comment_insert.php

<?php


  if(isset($_POST['task']) && $_POST['task'] == 'comment_insert')
  {
      require_once("db_connect.php");

     $userId = (int)$_POST['userId'];
     $comment = addslashes( str_replace( "
", "<br>", $_POST['comment']));

     $std = new stdClass();
     $std->comment_id = 24;
     $std->userId = $userId;
     $std->comment = $comment;
     $std->userName = "georges matta";
     $std->profile_img = "images/default_img.jpg";

     require_once("comments.php");

     if(class_exists('Comments'))
     {
         $commentInfo = Comments::insert($comment.$userId);

         if($commentInfo!=null)
         {

         }
     }


     **echo json_encode($std);**


  }
  else
  {
      header("Location: /");
  }


?>

Two things. 1. See if the data you are parsing has some invalid charecters or not.

  1. If you are getting collection of JSON objects and you are trying to parse through them and bind them, you should look through the JSON object and bind it to the view.
 if(class_exists('Comments'))
     {
         $commentInfo = Comments::insert($comment,$userId);

         if($commentInfo!=null)
         {

         }
     }

I think Insert function accepts 2 variables like comment and userid But you mentioned as one variable as $comment.$userid

I think this is the problem once execute your code after change the . as ,