title: jQuery Mobile/MVC: Getting the browser URL to change with RedirectToAction
body: <p>My first post...</p>
  
  <p><strong>When I use RedirectToAction the url in the browser doesn't change. How can I achieve this?</strong></p>
  
  <p>I'm switching over to ASP.NET MVC 3.0 (also using jQuery Mobile) after 10+ years using web forms. I'm about 8 weeks into it, and after several books and scouring Google for an answer, I'm coming up dry.</p>
  
  <p>I have a single route defined in Global.asax:</p>
  
  <pre><code>routes.MapRoute(
  "Routes",
  "{controller}/{action}/{id}",
  new { controller = "Shopping", action = "Index", id = UrlParameter.Optional }
  </code></pre>
  
  <p>I have a ShoppingController with these actions:</p>
  
  <pre><code>public ActionResult Cart() {...}
  
  public ActionResult Products(string externalId) {...}
  
  [HttpPost]
  public ActionResult Products(List&lt;ProductModel&gt; productModels)
  {
      // do stuff
      return RedirectToAction("Cart");
  }
  </code></pre>
  
  <p>The url when I do a get and post (with the post having the RedirectToAction) is always:</p>
  
  <pre><code>/Shopping/Products?ExternalId=GenAdmin
  </code></pre>
  
  <p>After the post and RedirectToAction I want the url in the browser to change to:</p>
  
  <pre><code>/Shopping/Cart
  </code></pre>
  
  <p>I've tried Redirect, and RedirectToRoute but get the same results.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p><strong>[Update]</strong>
  I found that jQuery Mobile AJAX posts are the culprit here. If I turn off jQuery Mobile's AJAX it works.</p>
  
  <pre><code>&lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      // do not handle links via ajax by default
      $(document).bind("mobileinit", function () { $.mobile.ajaxEnabled = false; });
  &lt;/script&gt;
  &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.0rc2/jquery.mobile-1.0rc2.min.css" /&gt;
  </code></pre>
  
  <p>The ordering of the above scripts is important. I had to include the script to jQuery first, then include the script to disable jQuery Mobile's use of AJAX and then include the script to jQuery Mobile.</p>
  
  <p>I'd still like to find a way to use AJAX and have the url update properly. Or at the least be able to call jQuery Mobile's "loading" message (or bake my own).</p>