title: AntiforgeryToken Not Recognized In Ajax Call
body: <p>I have a scenario where i dont need to send form data but some other data through ajax call. I have a form which contains <code>html.AntiForgeryToken()</code> . </p>
  
  <p>This is what i tried.</p>
  
  <pre><code>var modid = $("#moduleList").val();
  var data = {};
  data.modid = modid;
  
  var token = $('#frmmmenu input[name="__RequestVerificationToken"]').val();
  data.__RequestVerificationToken = token;
  //var dataWithToken = $.extend(data, token);
  $.ajax({
      type: "POST",
      url: "Home/MainMenu",
      data: JSON.stringify(data),
      //contentType: "application/json; charset=utf-8",  // request data type
      dataType: "html",  // response data type
      success: function (msg) {
  
          $("#accordion").html(msg);
      },
      error: function (msg) {
          alert("Ajax Error");
      },
  });
  </code></pre>
  
  <p>But i keep getting  <code>The required anti-forgery form field "__RequestVerificationToken" is not present</code>. error.</p>
  
  <p>Here is the Firebug Screen grab </p>
  
  <p><a href="https://i.stack.imgur.com/Lt54e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lt54e.png" alt="enter image description here"></a></p>
  
  <p>Also My action method is decorated with ValidateAntiForgeryToken</p>
  
  <pre><code>[HttpPost]
  [Authorize]
  [ValidateAntiForgeryToken]
  public ActionResult MainMenu(int modid)
  {
  }
  </code></pre>
  
  <p>What is causing this ? Any Ideas ?</p>
  
  <p><strong>EDIT</strong> :
  This is a MVC5 Project.</p>