title: jQuery AJAX/POST not sending data to PHP
body: <p>So I have this problem for a while now, and I know there are countless questions on this topic, believe me I tried every solution possible but still does not work.</p>
  
  <p>This is the simplest of examples which in my case is not working</p>
  
  <p>jQuery:</p>
  
  <pre><code>$.ajax({
      url: "ajax/add-user.php",
      type: "POST",
      data: {name: 'John'},
      success: function(data){
          console.log(data);
      }
  });
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>echo json_encode($_POST);
  </code></pre>
  
  <p>That's it.
  I always get back an empty array as a response. I tried with <code>serialize()</code> for the <code>data:</code> but the response is always empty. I get no errors whatsoever, just an empty array when I should get the posted values.</p>
  
  <p>If, for example, in php I try to <code>echo</code> some hard-coded variables I get them, but the <code>$_POST</code> and <code>$_GET</code> don't work.</p>
  
  <p>Any solution or methods of how I can identify the problem ? </p>
  
  <p>Thank you.</p>
  
  <p><strong>EDIT/SOLUTION</strong></p>
  
  <p>Ok, so it seems the problem was with .htaccess which rewrites the url and removes the extension. In the network tab indeed the request was moved permanently. Removing the .php extension from the ajax url: solved it. Thank you and sorry for wasting time. Cheers</p>