title: ASP.NET MVC Ajax ActionLink ActionName vs AjaxOptions URL difference?
body: <p>See this simple Razor markup:</p>
  
  <pre><code>@Ajax.ActionLink("Load something", "LoadPartialView", new AjaxOptions
          {
              UpdateTargetId = "here",
              LoadingElementId = "loading",
              OnBegin = "show_loading",
              OnComplete = "hide_loading",
              Url = "/Home/LoadPartialView2"
          })
  </code></pre>
  
  <p>I notice if I include <code>LoadPartialView</code> as a parameter in the <code>ActionLink</code> <strong>and</strong> also specify a URL <em>LoadPartialView2</em> in <code>AjaxOptions</code>, the generated link will invoke the <em>LoadPartialView2</em> action. The optional <code>Url</code> takes priority:</p>
  
  <ul>
  <li><p>If <code>Url</code> was removed, then clicking the link will invoke
  <code>LoadPartialView</code>.</p></li>
  <li><p>If <code>ActionName</code> parameter was set to null, vice versa,
  <code>LoadPartialView2</code> will be invoked.</p></li>
  </ul>
  
  <p>When would the URL in <code>AjaxOptions</code> be used over <code>ActionName</code>?</p>
  
  <p>I noticed if I set <code>Url</code> to <code>http://www.google.co.uk</code> it doesn't load the page into the <code>div</code> tag (<code>id="here"</code>).</p>
  
  <p>Thanks!</p>