从JS变量更新Query字符串中的PHP变量

I'm trying to check textbox input against a set of words in a certain order from the database to see if they match. If they do, the user's "quest" will be incremented, which will be sent to the relational database to return a new set of words for that given quest ID. the JavaScript questNum and PHP questNum variables seem to be appropriately incrementing, but the query is not getting the right result sets.

Utilities.js file:

When the page loads, I load the words for the first quest:

$(document).ready(function() {
    $.each(wordsArray, function(key, value) {
        $(".wordBank_Words").append("<div class='bank-word' word='" + key + "' ><b>" + key + "</b>: " + value + "</div>");
    });

    /*If user clicks word in word bank, word is added to text box*/
    $(".bank-word").click(function (event) {
        $('#textBox').val($('#textBox').val() + " " + $(this).attr('word'));        
        //hide word from word bank
         $(this).hide();
    });


    /*If User removes word from text box, add it back to word bank*/
    $('#textBox').on('change', function(){
        var words = $(this).val().split(' ');
        $('.bank-word').each(function(){
           if( words.indexOf( $(this).attr('word') ) !== -1 ){
               $(this).hide();
           }
           else {
               $(this).show();
           }
        });
    });
});

/*Check player sentence input to see if grammar is correct*/
function submitMe() {
    var input = document.getElementById('textBox').value;

    if ($.trim(input) == getSentence(questNum)) {
        $("#responseVerify").html("Great job");
        $("#textBox").val("").trigger("change");
        questNum++;
        $.get("php/Quests.php", { "_questNum" : questNum},
            function(returned_data) {
                $("#output").html(returned_data);
            }
        );
    }
    else {
        $("#responseVerify").html("Keep going...");
    }
}

Quests.php file:

<?php
    //if user's input is correct, increment task number
    include 'DbConnect.php';
    $questNumber = (isset($_GET['_questNum']) ? ($_GET['_questNum']) : 1);  

    echo "testing..." . $questNumber;

    $sql = $mysqli->query(
     "SELECT t.*, v.* 
     FROM task t 
     INNER JOIN vocabtask vt ON (t.id = vt.taskid)
     INNER JOIN vocab v ON (v.id = vt.vocabid)
     WHERE vt.taskid = " . $questNumber);
    $wordsArray = array();               
    while ($row = $sql->fetch_assoc()) {
        $wordsArray[$row['chinese']] = $row['english'];
    }
    mysqli_close($mysqli);  

    echo "<script type='text/javascript'> var wordsArray = " . json_encode($wordsArray) . "; </script>";
?>

Before the user enters the correct sentence into the text box, echo "testing..." . $questNumber; gives output:

testing...1

When the user enters the correct string into the text box, the JS variable questNum++; is incremented, and then echo "testing..." . $questNumber; gives output:`

testing...2

So I know that the incremented JS questNum is being sent to the PHP file...

Yet the query WHERE vt.taskid = " . $questNumber); doesn't seem to be returning the appropriate new sets of words.

DB is set up as such, so I would expect that the new relational set for the new quest number would be displayed, but it's the same set of values.

enter image description here

So why isn't the query being changed?

Thanks


EDIT: Echoing out the sql gives:

1) Before I increment the questNum:

SELECT t.*, v.* FROM task t INNER JOIN vocabtask vt ON (t.id = vt.taskid) INNER JOIN vocab v ON (v.id = vt.vocabid) WHERE vt.taskid = 1

2) After I increment the questNum:

SELECT t.*, v.* FROM task t INNER JOIN vocabtask vt ON (t.id = vt.taskid) INNER JOIN vocab v ON (v.id = vt.vocabid) WHERE vt.taskid = 2

I copied both of these into phpMyAdmin with success:

enter image description here

enter image description here

<?php
    //if user's input is correct, increment task number
    include 'DbConnect.php';
    $questNumber = (isset($_GET['_questNum']) ? ($_GET['_questNum']) : 1);  

    echo "testing..." . $questNumber;
    $sql_str = "
     "SELECT t.*, v.* 
     FROM task t 
     INNER JOIN vocabtask vt ON (t.id = vt.taskid)
     INNER JOIN vocab v ON (v.id = vt.vocabid)
     WHERE vt.taskid = " . $questNumber";
    $sql = $mysqli->query($sql_str);
    $wordsArray = array();
    while ($row = $sql->fetch_assoc()) {
        $wordsArray[$row['chinese']] = $row['english'];
    }
    mysqli_close($mysqli);  
    echo json_encode($wordsArray);
?>

function submitMe() {
    var input = $("#textBox").val();

    if ($.trim(input) == getSentence(questNum)) {
        $("#responseVerify").html("Great job");
        $("#textBox").val("").trigger("change");
        questNum++;
        $.ajax({
            url: "php/Quests.php",
            dataType: "json",
            method: "GET",
            data: {"_questNum":questNum},
            success: function(result){
                $.each(result, function(key, value) {
                    $(".wordBank_Words").append("<div class='bank-word' data-word='" + key + "' ><b>" + key + "</b>: " + value + "</div>");
                });             
            }
        });
    }else {
        $("#responseVerify").html("Keep going...");
    }
}