title: Spring security post request with AJAX (Logout)
body: <p>As I am moving from Spring 3.1.1.RELEASE to 4.0.2 RELEASE I have had to make some changes to spring security context.</p>
  
  <p>Almost everything is ok except POST Request for logout.</p>
  
  <p>I could make entire line to be form method="POST" action="logout" but then I have to deal with Submit which is totally different styling then what we need.
  I have tried sending logout request with csrf data over ajax with no success.
  Any help is greatly appreciated. P.S. Disabling csrf is not an option.</p>
  
  <pre><code> &lt;!-- JSP --&gt;
   &lt;meta name="_csrf" content="${_csrf.token}"/&gt;
  &lt;!-- default header name is X-CSRF-TOKEN --&gt;
  &lt;meta name="_csrf_header" content="${_csrf.headerName}"/&gt;
  
  &lt;!--Anchor --&gt;
  &lt;a id="loggg" href="logout"&gt;Logout1&lt;/a&gt;
  
  &lt;!-- jquery --&gt;
  $("#loggg").click(function(e){
      e.preventDefault();
       var token = $("meta[name='_csrf']").attr("content");
        var header = $("meta[name='_csrf_header']").attr("content");
      $.ajax({
          url : "logout",
          method : "POST",
          data :token ,
          success : function(data) { 
              console.log("clicked");
          }, 
          error : function(data) {
              console.log(data);
          }
      });
  
  })
  </code></pre>
  
  <p>FireBug developer console returns : </p>
  
  <pre><code>403 Forbidden 2ms
  "NetworkError: 403 Forbidden - http://localhost:8081/nekretnine/logout"
  Object { readyState=4,  responseText="&lt;!DOCTYPE html&gt;&lt;html&gt; 
  &lt;he...EASE&lt;/h3&gt;&lt;/body&gt;&lt;/html&gt;",  status=403,  more...}
  </code></pre>