title: ASP.NET MVC - AjaxContext
body: <p>I've tried to inspect the AjaxContext that ASP.NET-MVC uses on for instance Ajax Actionlinks and their onSucces, onComplete etc. clientside functions. But I don't understand very much of it... Where is the documentation on this thing? </p>
  
  <p><strong>Does anybody know how to I get the 'target' or 'srcElement' (e.target or window.event.srcElement) when I am in a onSuccess or onComplete javascript event?</strong></p>
  
  <pre><code>&lt;%=Ajax.ActionLink(
  "LinkText", "Action", New With {.Controller = "ControllerName"}, 
  New AjaxOptions With {
      .UpdateTargetId = "divElement", 
      .OnSuccess = "function(ajaxContext) {console.log(ajaxContext);}"
  }) %&gt;
  </code></pre>
  
  <p>Which results in:</p>
  
  <pre><code>&lt;a 
      href="/Popout/ApplicationCodePopout"
      onclick="Sys.Mvc.AsyncHyperlink.handleClick(
          this, new Sys.UI.DomEvent(event), 
          { 
              insertionMode: Sys.Mvc.InsertionMode.replace, 
              updateTargetId: 'divElement', 
              onSuccess: Function.createDelegate(this, 
                  function(ajaxContext) {console.log(ajaxContext);}
              )
          }
      );"
  &gt;LinkText&lt;/a&gt;
  </code></pre>