title: PHP POST using JS Fetch API
body: <p>I don't know why it's not working. It returns empty <code>$_POST</code>.</p>
  
  <p>JS:</p>
  
  <pre><code>const updateRequest = new FormData();
  updateRequest.append('updateRequest', 'next-period');
  
  
  fetch('file.php', {
    method: 'POST',
    data: updateRequest
  })
  
    .then((response) =&gt; response.text())
  
    .then((text) =&gt; {
      console.log(text);
    })
  </code></pre>
  
  <p>PHP:</p>
  
  <pre><code>&lt;?php
  
  if($_SERVER['REQUEST_METHOD'] === 'POST') {
  
    var_dump(empty($_POST));
  
  }
  </code></pre>
  
  <p>In the PHP file, the server request is POST but var_dump logs true.</p>