title: MVC 4 PartialViewResult caching on jQuery $.post
body: <p>I have a jQuery $.post back to a MVC 4 Controller that will return back a PartialViewResult with rendered using the data sent in the POST. When debugging the Partial View and Controller, the correct data is being received and sent to the Partial View as the View Model. The issue is, when analyzing the HTML sent back in the AJAX result it is containing seemingly "cached" data from the original page refresh. </p>
  
  <p>I have seen a good amount of posts on here that are similar, but none that were the same as my issue. </p>
  
  <p>I am aware that HTTP Post requests do not cache in the browser, so that is not the issue. I also have set the set the OutputCache attribute to NoStore = true, etc. </p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>[OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
  public partial class MyController : Controller
  { 
    ...
      [HttpPost]
      public virtual ActionResult UpdatePartial(MyViewModel myVm)
      {
          return this.PartialView("My/_Partial", myVm);
      }
  }
  </code></pre>
  
  <p><strong>JS</strong></p>
  
  <pre><code>$('.someButton').click(function () {
          $.post(myAjaxUrl, $('form').serialize(), function (data) {
              $('#myContent').html(data);
          });
      });
  </code></pre>