title: How can I pass parameters to the OnSuccess function of the AjaxOptions class in ASP.NET MVC?
body: <p>How can I pass parameters to the <code>OnSuccess</code> function of the <code>AjaxOptions</code> class in ASP.NET MVC?</p>
  
  <p>Here's my code but it doesn't work:</p>
  
  <pre><code>&lt;%= Ajax.ActionLink("Delete", 
                      "Delete", 
                      "MyController", 
                      New With {.id = record.ID}, 
                      New AjaxOptions With 
                      {
                          .Confirm = "Delete record?", 
                          .HttpMethod = "Delete", 
                          .OnSuccess = "updateCount('parameter')"
                      })
  %&gt;
  </code></pre>
  
  <hr>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Setting the <code>OnSuccess</code> property to <code>(function(){updateCount('parameter');})</code> solved my problem:</p>
  
  <pre><code>&lt;%= Ajax.ActionLink("Delete", 
                      "Delete", 
                      "MyController", 
                      New With {.id = record.ID}, 
                      New AjaxOptions With 
                      {
                          .Confirm = "Delete record?", 
                          .HttpMethod = "Delete", 
                          .OnSuccess = "(function(){updateCount('parameter');})"
                      })
  %&gt;
  </code></pre>