title: MVC3 - Ajax actionlink - OnBegin, onComplete
body: <p>Using MVC3, C#, and the Razor View Engine:
  I have a form that has an Ajax Action link. In the options I'm trying to specify OnBegin and OnComplete javascript function calls. In this question, I took out the meat of the functions and simply added alerts so that I could verify that the functions where being hit. What I really want to do with these functions is to use $.blockUI for the duration of the ajax call. </p>
  
  <p>The pertinent code looks like this:</p>
  
  <pre><code>@Ajax.ActionLink("my test link", "myAction", new { Controller = "myController" }, new AjaxOptions { OnBegin = "ajaxStart", OnComplete = "ajaxStop" })
  
  &lt;script type="text/javascript"&gt;
      function ajaxStart() {
          alert("start");
      }
  
      function ajaxStop() {
          alert("stop");
      }
  
  &lt;/script&gt;
  </code></pre>
  
  <p>For some reason, the two functions never get called as specified. I have tried it with and without the parentheses, sucha as this:</p>
  
  <pre><code>@Ajax.ActionLink("my test link", "myAction", new { Controller = "myController" }, new AjaxOptions { OnBegin = "ajaxStart()", OnComplete = "ajaxStop()" })
  </code></pre>
  
  <p>Neither work.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks,
  Tony</p>