title: How to get CSRF token Value at javaScript
body: <p>I have requirement like that, when I send request, <code>CSRF-token</code> should be send with it. I Explore some SO questions, But I can't find Solution.</p>
  
  <p>I have written Code like bellow to add token when request being sent,</p>
  
  <pre><code> var send = XMLHttpRequest.prototype.send,
          token = $('meta[name=csrf-token]').attr('content');
      XMLHttpRequest.prototype.send = function(data) {
          this.setRequestHeader('X-CSRF-Token', "xyz12345");
          //this.setRequestHeader('X-CSRF-Token',getCSRFTokenValue());
          return send.apply(this, arguments);
      }
  </code></pre>
  
  <p>This is Working Fine, But now i need to add CSRF-Token in function in place of <code>xyz12345</code>.</p>
  
  <p>I have tried ajax function as below . 
  `</p>
  
  <pre><code>$.ajax({
              type: "POST",
              url: "/test/"
              //data: { CSRF: getCSRFTokenValue()}
          }).done(function (data) {
          var csrfToken = jqXHR.getResponseHeader('X-CSRF-TOKEN');
          if (csrfToken) {
              var cookie = JSON.parse($.cookie('helloween'));
              cookie.csrf = csrfToken;
              $.cookie('helloween', JSON.stringify(cookie));
          }
  
          $('#helloweenMessage').html(data.message);
  
      });
  </code></pre>
  
  <p>But it is not Yet Worked.
  So my question is:
   <em>How to get js side  CSRF-Token Value?</em></p>