jQuery AJAX PUT request data submission not working
<p>I have a PHP file which contains the following:</p>

<pre><code>if ($_SERVER['REQUEST_METHOD'] === 'PUT') {
    echo '{ "response": "' . $_REQUEST['id'] . '" }';
}
</code></pre>

<p>Now I want to make an AJAX call to this file via jQuery:</p>

<pre><code>var send = {
    id: 10
};

$.ajax({
    data: send,
    method: 'PUT',
    url: "myphpfile.php",
    success: function(responseData) {
        console.log(responseData.response);
    }
});
</code></pre>

<p>This should return <code>10</code> as a response, however the output is empty. In the PHP file I also tried writing the id to a text file, which turned out to be empty as well. This means that my PHP code isn't the problem here, it's JavaScript.</p>

<p>When I change the AJAX url to <code>myphpfile.php?id=10</code> however, the response is correct and <code>10</code> is logged to the console.</p>

<p>I have tried a lot of things to fix this, nothing worked. This includes setting <code>contentType: 'application/json; charset=utf-8'</code>, <code>dataType: 'json'</code> and <code>data: JSON.stringify(send)</code>. I can't find any more forum questions or articles on this and the ones I found didn't work.</p>

<p>Any help is appreciated.</p>