title: Passing parameters in Ajax post back in MVC
body: <p>I am trying to pass ID parameter from a view to a controller on a click delete link available on a selected row.</p>
  <p><strong>Simplified View Layout</strong></p>
  <pre><code>    @using (Html.BeginForm(&quot;#&quot;, &quot;Schedule&quot;, FormMethod.Post, htmlAttributes: new { @class = &quot;floating-labels&quot; }))
      {
      @Html.AntiForgeryToken()
  
     &lt;a href=&quot;#&quot; onclick=&quot;DeleteSchedule(1);&quot;&gt;Delete&lt;/a&gt;
      }
  </code></pre>
  <p><strong>JavaScript</strong></p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
      function DeleteSchedule(id) {
          if (confirm('Are you sure you want to delete this Schedule?')) {
              $.ajax({
                  type: &quot;POST&quot;,
                  url: '@Url.Action(&quot;Delete&quot;, &quot;Schedule&quot;, new { id = &quot;id&quot; })',
                  contentType: &quot;application/json&quot;,
                  data: { id },
                  async: true,
                  cache: false,
                  success: function (result) { success(result); }
              });
          }
          return false;
      }
  
      function success(result) {
          $(&quot;#ScheduleList&quot;).html(result);
      }
  &lt;/script&gt;
  </code></pre>
  <p><strong>Controller</strong></p>
  <pre><code>namespace Controllers
  {
      public class ScheduleController
      {
          [HttpPost]
          [ValidateAntiForgeryToken]
          public ActionResult Delete(int id)
          {
              //do stuff
          }
      }
  }
  </code></pre>
  <p>But on the click of a delete link I get below error and code does not hit controller action.<a href="https://i.stack.imgur.com/1ouLf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1ouLf.png" alt="enter image description here" /></a></p>
  <p>I am not able to figure out what mistake I am making...</p>