title: Ajax cannot display the response from php
body: <p>I know that this question is already answered a lot, but even the previous responses from php are working, this response cannot work and i cannot find the reason for this issue. 
  Although php was send the response succesfully, ajax cannot display without refreshing the page first. 
  Here is my jquery.ajax code in the file <code>helpers.js</code>:</p>
  
  <pre><code>function likeButton(commentId, userId) {
  $.ajax({
    url: "requests.php",
    type: "POST",
    data: {
      like: "likeUp",
      commentId: commentId,
      userId: userId
    },
    success: function(response) {
      $("#comment_body").append(response);
    }
  });
    }
  </code></pre>
  
  <p>Here is my php code in requests.php:</p>
  
  <pre><code> if(isset($_POST['like'])) {
    if($_POST['like'] == "likeUp") {
      $commentId = $_POST['commentId'];
      $userId = $_POST['userId'];
  
      $sql = "SELECT gaming_comment_like FROM gaming_comments WHERE gaming_comment_id='$commentId'";
      $result = mysqli_query($conn, $sql);
      if($row = mysqli_fetch_assoc($result)) {
        $gaming_comment_like = $row['gaming_comment_like'];
      }
      $gaming_comment_like = $gaming_comment_like + 1;
  
      $sql_update = "UPDATE gaming_comments SET gaming_comment_like='$gaming_comment_like' WHERE gaming_comment_id='$commentId'";
      $result_update = mysqli_query($conn, $sql_update);
      exit();
    }
  }
  </code></pre>
  
  <p>here is the eventhandler that calling the <code>likeButton</code> function, which is in a php file:</p>
  
  <pre><code>&lt;p&gt;&lt;img src='like.png' class='like_button' onclick='likeButton(".$gaming_comment_id.", ".$user_id.");'&gt;$gaming_comment_like&lt;/p&gt;";
  </code></pre>