title: Good practices for writing HTML in Javascript
body: <p>I was wondering about this if people have strong opinions about the best way to generate HTML on the fly, especially with Ajax based applications.</p>
  
  <p>Do you just create the HTML code using server side scripting and then send it out to the page or perhaps just return a JSON string and let Javascript do the job.  </p>
  
  <p>In my personal opinion, the first way ties the presentation layer way too much to the logic and makes it harder to change and a  nightmare to maintain.  The second way, although is my preferred method, also becomes a nightmare to maintain when the complexity of the project grows.  </p>
  
  <p>I was thinking of using a Javascript templating system as another layer, just to make the code more robust and less rigid.  Anyone has good ideas of a light and really good JS templating system?</p>