title: How can I correctly send data through 'PUT' with ajax in the request body like Backbone does
body: <p>I noticed that when saving data along with an id in backbone what it does is to send a 'PUT' request along with the data inside the request body ( in chrome dev tools appears as "request payload").
  How can I achieve this with JQuery Ajax?
  I have tried in several ways but none seems to send the data just like Backbone does.</p>
  
  <pre><code>$.ajax({
      url: '/v2/users/request/test',
      type: 'PUT',
      dataType: 'json',
      data: JSON.stringify({ "command": "on" }),
      success: function(data, status, jqXHR){
      },
      error: function(jqXHR, status, errorThrown){
      }
  })
  </code></pre>
  
  <p>in php I have this example on how to retrieve body data and display it:</p>
  
  <pre><code>if ($_SERVER['REQUEST_METHOD'] == 'PUT'){
              return file_get_contents('php://input');
          }
  </code></pre>