title: Self-AJAX-updating partial-view/controller in ASP.Net MVC and the duplicating div
body: <p>I have a partial view in MVC that goes something like:</p>
  
  <pre><code>&lt;div id="comments"&gt;
      ...
  &lt;/div&gt;
  </code></pre>
  
  <p>Inside that div there's a form that calls a controller using AJAX and gets back that same partial view. The problem is that the results of calling the view replaces the contents of the div, not the whole div, and I end up with:</p>
  
  <pre><code>&lt;div id="comments"&gt;
      &lt;div id="comments"&gt;
          ...
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>The only solution I can think about with my week of experience in ASP.Net MVC and AJAX is to put the div outside the partial view and make the partial view only contain the inside part, but then the form would refer to an id outside the view where the form is located breaking the little encapsulation I have left there. Is there any better solution?</p>