title: Ajax request, should it be POST or PUT
body: <p>I have created a Spring MVC web app.</p>
  
  <p>The app makes a few calls to the controller. These calls are close/open/end game.</p>
  
  <p>I make these calls using Ajax, so I can handle a response on the top of the page.</p>
  
  <pre><code>ajaxPost = function (url, action, id, onSuccess, onError) {
      $.ajax({
          type: "POST",
          url: url + "?" + action + "=" + id,     
          success: function(response) {
              if(onSuccess !== null) {
                  onSuccess(response);
              }
          },                                      
          error: function(e) {
              if(onError !== null) {
                  onError(e);
              }                           
         }                
      });
  };
  </code></pre>
  
  <p>The question I have is that I'm using 'POST' for the Ajax request, is that correct, or should it be 'PUT'?</p>
  
  <p>My controller has a default URL, and I'm using the param attribute to decide which method to call, as I have many buttons on the page.</p>
  
  <pre><code>@RequestMapping(params = "open", method = RequestMethod.POST)
  
  @RequestMapping(params = "close", method = RequestMethod.POST)
  </code></pre>
  
  <p>It doesn't sit well with me that I'm using 'POST' for these calls. Maybe it should be 'PUT'...</p>
  
  <p>Any suggestions? Does it matter?</p>