如何从ajax调用获取数组以使用php显示正确的结果

So I am pulling some values using AJAX and PHP and then displaying them. This is just an upvote system. What I am wondering is how can I display the results properly so that the value gets updated client side. Here is an example of code and what it does below.

Here is the AJAX portion that gets the array response from the PHP file in json.

function upVoteIncrementValue(postID){
event.preventDefault();
//var upVoteIncrement   = $("#upVoteIncrement").val();

$.ajax({
        type: "POST",
        url: "voting.php",
        data:  {
            "upVoteIncrement": postID,
            },
        dataType: "json",
        cache: false,
        success: function(response){
            if(response){
                var response = $.trim(response);
                if(response){
                    //$('#voteCount').html(response);
                      $('#voteCount-' + postID).html(response); //This is the working update
                }
                else {
                    return false;
                }
            }
        }
    });

}

Then here is the code that displays the results:

public function forumview($query){
    $stmt = $this->db->prepare($query);
    $stmt->execute();
    $results = $stmt->fetchAll();

    if($stmt->rowCount()>0){
        foreach($results as $row){

            echo '<tr>';
            echo '<td style="color: #333;"><span class="pull-right">';

            if(isset($_SESSION['user_session'])){

                    echo '<a href="#" class="upVoteArrow" onclick="upVoteIncrementValue('.$row['topic_id'].');"><i class="fa fa-arrow-up"></i></a> ';                   

            }else{

                echo '<a href="#" id="loginForm" class="upVoteArrow" data-toggle="modal" data-target="#loginModal"><i class="fa fa-arrow-up"></i></a> ';

            }
           //This is the part that displays the result but instead of 
           //displaying each in its respective div it only displays in the top div
            echo '<span id="voteCount-'.$row['topic_id'].'">'.$this->cleanNumber($row['topic_likes']).'</span>';

            if(isset($_SESSION['user_session'])){

                echo ' <a href="#" class="downVoteArrow" onclick="downVoteDecrementValue('.$row['topic_id'].');"><i class="fa fa-arrow-down"></i></a>';

            }else{

                echo ' <a href="#" id="loginForm" class="downVoteArrow" data-toggle="modal" data-target="#loginModal"><i class="fa fa-arrow-down"></i></a>';

            }

Here is a picture of what it's doing

enter image description here

It increments...That part works fine as in the 1st and 2nd example but when I Go to upvote the next value below it, it displays that value in the first location (98 moves up into the 1st location and increments to 99) how can I get the 98 to increment in it's place and not be displayed in the first location? Thanks again and appreciate all feedback.

Here is the PHP database portion if it comes in handy for anyone who might want to use it:

if(isset($_POST['upVoteIncrement'])){

$upVoteIncrement = $_POST['upVoteIncrement'];

$stmt = $conn->prepare('UPDATE topics SET topic_likes = topic_likes+1 WHERE topic_id = :id LIMIT 1');
$stmt->bindParam(':id', $upVoteIncrement);
$stmt->execute();


$upVote = $conn->prepare('SELECT topic_likes FROM topics WHERE topic_id = :id');
$upVote->bindParam(':id', $upVoteIncrement);
$upVote->execute();
$upVoteCount = $upVote->fetchAll();

if($upVote->rowCount() > 0){
    foreach($upVoteCount as $row){

        $up = $row['topic_likes'];
        $results[] = $up;
    }
}
echo json_encode($results);
}

if(isset($_POST['downVoteDecrement'])){

$downVoteDecrement = $_POST['downVoteDecrement'];

$stmt = $conn->prepare('UPDATE topics SET topic_likes = topic_likes-1 WHERE topic_id = :id LIMIT 1');
$stmt->bindParam(':id', $downVoteDecrement);
$stmt->execute();

$downVote = $conn->prepare('SELECT topic_likes FROM topics WHERE topic_id = :id LIMIT 1');
$downVote->bindParam(':id', $downVoteDecrement);
$downVote->execute();
$downVoteCount = $downVote->fetchAll();

if($downVote->rowCount() > 0){
    foreach($downVoteCount as $row){

        $down = $row['topic_likes'];
        $results[] = $down;
    }
}
echo json_encode($results); 

}