title: Bizzare behavior of MVC Action/RenderAction, ajax post, and Partial Views
body: <p>So the design ideal is to have one page with a couple different 'widgets' in this MVC app.  Each 'widget' should be able to submit information back to itself and reload only itself.  Simple in web forms, not so much with MVC it seems</p>
  
  <p>First, we have our main page controller, nothing special</p>
  
  <pre><code>public ActionResult Index()
  {
      return View();
  }
  </code></pre>
  
  <p>Next, we have our main page View. Note that I have tried both Action and RenderAction and there is no change in behavior</p>
  
  <pre><code>@Html.Action("Index", "Monitor", new { area = "Statistics" }); 
  
  &lt;div id="messages"&gt;
      @Html.Action("Index", "Messages", new { area = "Data"});
  &lt;/div&gt;
  
  @section Script {
      &lt;script src="@Url.Content("~/Scripts/jquery-1.9.1.min.js")" type="text/javascript"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
      $('#filter').click(function () {
          $.ajax({
              method: 'POST',
              url: '@Url.Action("Index", "Messages", new { area = "Data"})',
              success: function(data){
                  $('#messages').html(data);
              }
          });
          return false;
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>The Index ActionResult in the Messages Controller:</p>
  
  <pre><code>public ActionResult Index()
  {
      var model = GetMessages();
      return PartialView(model);
  }
  </code></pre>
  
  <p>For the sake of brevity, going to skip the whole of Monitor Index View, and only give a brief version of Messages Index View</p>
  
  <pre><code>@using (Html.BeginForm("Index", "Messages", FormMethod.Post))
  {
      //Some fields to limit results are here, with style classes
      &lt;button type="submit" id="filter"&gt;Filter&lt;/button&gt;
  }
  
  @foreach(var item in Model)
  {
      //Display results 
  }
  </code></pre>
  
  <p>Upon loading the main page, all looks good.  The fields to limit results are displayed, as well as messages.  I can enter something into the fields, click Filter, and am returned to the main page but!  ...the fields have lost their style classes and the messages are unfiltered.  </p>
  
  <p>Strange, but more strange is if I again enter information in the fields and click Filter, this time I am not taken to the main page, but get only the Partial View of the Messages Index displayed and the messages are not filtered.</p>
  
  <p>I can't say that the filtering not working is related to this issue or not, but the non-consistent behavior of clicking Filter is the part that bothers me. Anyone like to point out what I am doing wrong in here?</p>