如何从Ajax生成的下拉列表中获取php中的选项选择值。 下面的代码返回$ subcategoryID的空值

// get_sub_category.php

echo "<label for='subcategorySelect'>Sub-category</label>"; 
echo "<select id='subcategorySelect' name='subcategorySelect'>";
echo "<option value=''>Select</option>"; 

foreach($result5 as $row) { 
    echo "<option value='" . $row['subcategoryID'] . "'>" .   
    $row['subcategory'] . "</option>";
}

echo "</select>";

//PHP file //browse.php

<script>
    function getData(dropdown) {
        var category = dropdown.options[dropdown.selectedIndex].value;
        var dataString = "categoryID="+category; 

        $.ajax({
            type: "POST",
            url: "get_sub_category.php", // Name of the php files
            data: dataString,
            success: function(html)
            {
                $("#get_category").html(html);
            }
        });
    }
    var subcategoryID=document.getElementById("subcategorySelect").value;
</script>
<?php   
    $subcategoryID=$_POST['subcategoryID'];  
    $_SESSION['subcategoryID']=$subcategoryID;
?>

The $subcategory returns empty. How can I get the value selected in a php variable?