title: AJAX SyntaxError: JSON.parse: unexpected character
body: <p>I've been trying to find out the issue with this for days. As my data is being sent and retrieved, yet it doesn't post into my div.. Why? I did a test and found that I a SyntaxERROR unexpected character.. And can I find it.. Can I heck. </p>
  
  <p>Can someone look through this and tell me of any mistakes please. </p>
  
  <pre><code>&lt;script&gt;
  $(document).ready(function(){
      $("form#mycommentform").submit(function() {
  
          var streamidcontent = $(this).children("#streamidcontent").val();
          var contents = $(this).children("#contents").val();
          $.ajax({
              type: "POST",
              url: "comment_add.php",
              cache: false,
              dataType: "json",
              data: { streamidcontent: streamidcontent, contents: contents }, 
              success: function(data){  
                  $("#containerid").html('&lt;div class="stream_comment_holder" id="comment_holder_'+data['comment_streamitem']+'"&gt;\
                  &lt;div id="comment_list_'+data['comment_streamitem']+'"&gt;\
                  &lt;div id="tgy"&gt;&lt;/div&gt;&lt;div class="stream_comment" id="comment_'+data['comment_id']+'" style="margin-top:0px;"&gt;\
                  &lt;table width=100%&gt;&lt;tr&gt;&lt;td valign=top width=30px&gt;&lt;/a&gt;&lt;td valign=top align=left&gt;\
                  &lt;a href="/profile.php?username='+data['username']+'"&gt;'+data['first']+'&lt;/a&gt;\
                  &lt;div class="commentholder"&gt;'+data['first']+'&lt;/div&gt;&lt;br/&gt;\
                  &lt;div id="commentactivitycontainer"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/table&gt;&lt;/div&gt;&lt;/div&gt;\
                  &lt;div class="form"&gt;&lt;form id="mycommentform" method="POST" class="form_statusinput"&gt;\
                  &lt;input type="hidden"  name="streamidcontent" id="streamidcontent" value="'+data['comment_streamitem']+'"&gt;\
                  &lt;input type="text" name="contents" id="contents" placeholder="Say something" autocomplete="off"&gt;\
                  &lt;input type="submit" id="button" value="Feed"&gt;&lt;/form&gt;&lt;/div&gt;\
                  &lt;div class="stream_comment_holder" style="display:;"&gt;&lt;div class="like_name"&gt;&lt;b&gt;\
                  &lt;a href="profile.php?username='+data['username']+'"&gt;You Like This&lt;/a&gt;\
                  &lt;/b&gt;&lt;/div&gt;&lt;/div&gt;');
                    alert("SUCCESS!!!");
   },
   error: function (xhr, ajaxOptions, thrownError) {
      alert(xhr.statusText);
      alert(xhr.status);
      alert(thrownError);
   }
   });
          return false
      });
   });
   &lt;/script&gt;
  </code></pre>
  
  <p>REPONSE</p>
  
  <pre><code>INSERT INTO streamdata_comments(comment_poster, comment_streamitem, comment_datetime, comment_content) VALUES (10,4090,UTC_TIMESTAMP(),'fff'){"comment_id":"2016","comment_streamitem":"4090","username":"hazy","id":"10","first":"Lucy","middle":"","last":"Botham"}
  </code></pre>
  
  <p>PHP PAGE</p>
  
  <pre><code>&lt;?php
  session_start();
  require"include/rawfeeds_load.php";
  
  if(isset($_POST['streamidcontent'])&amp;isset($_POST['contents'])){
  rawfeeds_user_core::add_comment($_POST['streamidcontent'],$_POST['contents']);
  
  
  $json = array();
  $check = "SELECT comment_id, comment_datetime, comment_streamitem, comment_poster FROM streamdata_comments WHERE comment_poster='".$_SESSION['id']."' AND comment_streamitem='".$_POST['streamidcontent']."' ORDER BY comment_datetime DESC";
  $check1 = mysqli_query($mysqli,$check);
  $resultArr = mysqli_fetch_array($check1);
  $json['comment_id'] = $resultArr['comment_id'];
  $json['comment_streamitem'] = $resultArr['comment_streamitem'];
  mysqli_free_result($check1);
  
  $check = "SELECT * FROM users WHERE id=".$_SESSION['id']."";
  $check1 = mysqli_query($mysqli,$check);
  $resultArr = mysqli_fetch_array($check1);
  $json['username'] = $resultArr['username'];
  $json['id'] = $resultArr['id'];
  $json['first'] = $resultArr['first'];
  $json['middle'] = $resultArr['middle'];
  $json['last'] = $resultArr['last'];
  mysqli_free_result($check1);
  
  echo json_encode($json);
  }
  ?&gt;
  </code></pre>