title: Echoing HTML or generate it through JS
body: <p>I have a functional project that is basically a database table editor. You load a table and you can get the rows info, edit it, add, delete, add child rows, etc.</p>
  
  <p>I am rewriting the entire thing because it is very unorganized. I am attempting to create a class based system (yes I had 0 classes). This is my first class based project and, that being another issue, I would like to know the best (performance, maintainability, ease-of-writing) way to generate dynamic HTML. I use Javascript and PHP</p>
  
  <p>Really the options, when outputting dynamic HTML are:</p>
  
  <ol>
  <li><p>Echo it directly, or JSON encoded, from a PHP function or class</p></li>
  <li><p>Build it from Javascript and append things to the document</p></li>
  </ol>
  
  <p>I can either make a request from JS and append the data directly from PHP, or I can just get back raw data from PHP (database) and build it using JS. I really don't know what the optimal way to go here is. Currently I am raw echoing my tables and editing forms, and it works, but it's a mess.</p>