title: Dynamically refresh a div without a straightful DOM manipulation
body: <p>I have to update for example a table, a list if some values. I can insert new values and try to reload a entire page to show table or list values again.</p>
  
  <p>If I give a try on Ajax updates I have to manipulate DOM, creating a bunch of new tags, concatenate and inject the new HTML on old one. This not a painful way, you even must re-type the code created before to exhibit new entries.</p>
  
  <p>E.g: this is a fictitious example and illustrates what I mean:</p>
  
  <pre><code>$.ajax({
      url: '/post/addComment/',
      type: 'POST',
      data: 'comment=' + comment,
      beforeSend : function() {
          //waiting message
          $('#some_information_div').html('&lt;strong&gt;Updating...&lt;/strong&gt;');
      }
  }).done(function(data) {
          //new data comes here (by JSON, plain text, whatever...)
          if (data.status == 'OK') {
              //OHHH MAN WE HAVE TO POPULATE MANUALLY IT AGAIN
              var c = '';
              c = '&lt;table&gt;'
  
              data.content.forEach(function(e) {
                  c += '&lt;tr&gt;&lt;td&gt;' + e.name + '&lt;/td&gt;&lt;/tr&gt;';
              });
  
              c += '&lt;/table&gt;'
  
              //update with new values
              $('#some_information_div').html('');
              $('#destination_table').html(c);
          }
  });
  </code></pre>
  
  <p>Unfortunately I have to do all the time with my lists and tables and somehow I have to re-type codes and manipulate it all by the javascript. I figured out something might be useful like does <a href="http://api.jquery.com/load/" rel="nofollow">jQuery.load()</a>, maybe it can fit what I want to, I have not tried it.</p>
  
  <p>Some other languages and frameworks like JSF do it easily with "render technique", you directly update content without have to create and manipulate DOM in manually way.</p>
  
  <p>Please, any kind of suggestion, any clue to this approach will be very helpful.</p>
  
  <p>P.S.: The code sample tag doesn't work well here.</p>