title: ASP.NET MVC 4 - Ajax.ActionLink calls the method multiple times
body: <p>This is the part of code in </p>
  
  <pre><code>&lt;script type="text/javascript" src="~/scripts/jquery.unobtrusive-ajax.js"&gt;&lt;/script&gt;
  Ajax.ActionLink("Yes", "Delete", "Notes", new { id = item.NoteId }, new AjaxOptions { HttpMethod = "POST", OnComplete = "javascript:void(0);" }, new { id = item.NoteId, @class = "yes" });
  </code></pre>
  
  <p>Upon clicking it is supposed to call the following action: </p>
  
  <pre><code>    [HttpPost]
      public bool Delete(int id)
      {
          Notes notes = db.Notes.Find(id);
          db.Notes.Remove(notes);
          db.SaveChanges();
  
          return true;
      }
  </code></pre>
  
  <p>And it does - the note gets deleted. But the method is called 5 or 8 more times for some reason.</p>
  
  <pre><code> POST http://localhost:57904/Notes/Delete/41 500 (Internal Server Error) jquery-1.8.2.min.js:2
   POST http://localhost:57904/Notes/Delete/41 500 (Internal Server Error) jquery-1.8.2.js:8416
   POST http://localhost:57904/Notes/Delete/41 500 (Internal Server Error) jquery-1.8.2.min.js:2
   POST http://localhost:57904/Notes/Delete/41 500 (Internal Server Error) jquery-1.8.2.js:8416
  </code></pre>
  
  <p>What could be the cause of the extra calls?</p>