I have the following code snippet below. When the "Create Order" button is clicked, the user inputted data (not shown in the code) is converted to JSON, via the function "convertToJson". I am able to convert the data to JSON. My problem is passing the JSON object to PHP so that I can insert the object to the database. PHP is returning a "Null" value when I run $var_dump.
Note that I am trying to POST to the same page, which is "orders.php"
     <head>
        <script type="text/javascript">
        function convertToJson()
        {
            var tableData = $('#productOrder').tableToJSON({
            ignoreColumns: [0]
            }); 
            var xhr = new XMLHttpRequest();
            xhr.open("GET","orders.php",true);
            xhr.setRequestHeader("Content-Type", "application/json");
            xhr.send(JSON.stringify(tableData));            
        }   
        </script>
     </head>
    ...more code...     
    <button type="button" class="btn btn-success btn-md" style="float: right;" onclick="convertToJson();">Create Order</button>
    <div>
    <?php
        $data = json_decode(file_get_contents('php://input'));
        var_dump($data);
    ?>
    </div>
 
    