title: Error 405 Method Not Allowed when sending a PUT AJAX request to PHP with jQuery
body: <p>I am just trying to implement a REST-like application with PHP + jQuery.</p>
  
  <p>In the very first attempt I started getting this error</p>
  
  <blockquote>
    <p>PUT http://... 405 (Method Not Allowed)</p>
  </blockquote>
  
  <p>I put this in the very first line of my PHP script</p>
  
  <pre><code>header("Access-Control-Allow-Orgin: *");
  header("Access-Control-Allow-Methods: *");
  </code></pre>
  
  <p>And this is my jQuery code:</p>
  
  <pre><code>$(function(){
      $.ajax({
          url: 'localhost/myscript.php',
          type: 'PUT',
          success: function(response) {
              //...
          }
      });
  });
  </code></pre>
  
  <p>I did nothing special in terms of configuration. 
  Why is my Ajax request getting rejected and how can I solve this?</p>