title: Post JSON and Submit Form (or redirect)
body: <p>I'm struggling with how to properly submit a form where I really only need to send the JSON and not the form controls. I have a SubmitOrder() javascript function:</p>
  
  <pre><code>function SubmitOrder() {
      var selectedProductsAsJson = JSON.stringify(selectedProducts);
      // This line works...
      $.post('/OrderCheckout/Save', { jsonData: selectedProductsAsJson });
      // ... or this line works...
      $('#productListForm').submit();
      // but not both lines together.
  }
  </code></pre>
  
  <p>What I'm trying to do is send selectedProductsAsJson to my controller, process it, then send the user to a new page. The $.post line accomplishes the first two actions, but I don't know how to send the user to a new page after that.</p>
  
  <p>If I just do the .submit() line, the user is redirected to the new page, but the controller doesn't have the json data to process.</p>
  
  <p>If I use both lines, the $.post call is asynchronous and the user will end up on the new form before the $.post call completes. I read <a href="https://stackoverflow.com/a/2418402/279516">here</a> that I can make the $.post call synchronous, but it seems like I should be able to do all of this with one call to the server. What am I missing to make this happen?</p>
  
  <p>My controller currently looks like this;</p>
  
  <pre><code>public class OrderCheckoutController : Controller
  {
      public ActionResult Index()
      {
          return View();
      }
  
      public void Save(string jsonData)
      {
          List&lt;Product&gt; selectedProducts = new JavaScriptSerializer().Deserialize&lt;List&lt;Product&gt;&gt;(jsonData);
          decimal totalPrice = selectedProducts.Sum(x =&gt; x.Price);
          ViewBag.SaleTotal = totalPrice;
      }
  }
  </code></pre>