title: After calling jQuery load or $.ajax with datatype html element does not update
body: <p>I am currently having a problem where when the jQuery Load is called an element which was previously updateable is no longer updateable it reverts to its original state and although it is still accessible and updateable the visual on the screen does not change.</p>
  
  <p>The element is in the a partial view in the layout page. While the load event is being called from a click in a <code>&lt;li&gt;</code> menu item. Which then calls load and attempts to get the possible changes in cart.</p>
  
  <p><img src="https://i.stack.imgur.com/tMZOl.png" alt="enter image description here"></p>
  
  <p><strong>Partial View Code</strong></p>
  
  <pre><code>&lt;div id="cart" style="float:right;clear:right;margin-top:31px;height:21px;"&gt;
      &lt;span&gt;
          &lt;a href='/ShoppingCart/ShoppingCart'&gt;&lt;img style='height:16px;margin-bottom:5px;' src='../Content/images/cartImage.gif' alt='cart' /&gt;0 Total : 0&lt;/a&gt; 
      &lt;/span&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>Layout Code</strong></p>
  
  <pre><code>function GetCart() {
      var url = "/ShoppingCart/GetCartAmount/";
      $.ajax({
          url: url,
          data: {},
          cache: false,
          type: "POST",
          success: function (result) {
              var markup = "&lt;span&gt; &lt;a href='/ShoppingCart/ShoppingCart'&gt;&lt;img style='height:16px;margin-bottom:5px;' src='../Content/images/cartImage.gif' alt='cart'/&gt;&lt;/a&gt; " +
                  result.ItemCount + "  Total: " + result.Total + "&lt;/span&gt;";
  
              $("#cart").html(markup);
              alert($('#cart').html());
  
              alert("after set");
          },
          error: function (reponse) {
              alert("error : " + reponse);
          }
      });
  }
  </code></pre>
  
  <p>The Ajax code is in a function with other processing.</p>
  
  <pre><code>$.ajax({
      url: data.redirectUrl,
      dataType: "html",
      success: function (responseText) {
          var tempDiv = $.parseHTML(responseText);
          $("#result").html(tempDiv).show();
      }
  });
   GetCart();
  </code></pre>
  
  <p><strong>Controller Code</strong></p>
  
  <pre><code>&lt;HttpPost()&gt;
  Function GetCartAmount() As ActionResult
          Dim ItemCount = GetCart().Count
          Return Json(New With {.Total = GetCartTotal().ToString, .ItemCount = ItemCount})
  End Function
  
  Public Function GetCart() As List(Of WebItemModel)
          Dim retValue As New List(Of WebItemModel)
          If Session("Cart") IsNot Nothing Then
              retValue = DirectCast(Session("Cart"), List(Of WebItemModel))
          End If
          Return retValue
  End Function
  </code></pre>
  
  <p>If any further code should be provided please do tell me. I didn't post it all since it would take up too much space and possibly confuse people. Also to make a point it initially works before the jQuery load occurs.</p>