title: Good DRY approach to rendering and AJAX updating of page
body: <p>Imagine a review site where users enter ratings and optionally short comments.</p>
  
  <p>On each review page you've got many comments - these are displayed in a table at the end of the page <em>(btw - not looking for datagrid type controls, far too simple for that)</em></p>
  
  <p>I want to let users enter new reviews and update the page without a page refresh.<em>(all simple stuff so far, this is not the question)</em></p>
  
  <p>What is a good approach to generating for the page. Some thoughts :-</p>
  
  <ol>
  <li><p>Generate the reviews HTML server side, append new reviews using javascript client side. Downside is that you've got table HTML generation code in two places.
  Upside - more content on page as far as search engines concerned.</p></li>
  <li><p>Server side only output reviews as json/xml/whatever and render HTML dynamically on page load using javasript.</p>
  
  <p>Downside - 'template' in javascript, hard for designers to customize + lack of 'content' on page.</p></li>
  <li><p>Is there an approach that combines the two methods - i.e. a templating framework that will render existing data server side but also sends the template fragment client side so it can be reused there for additions/edits.</p></li>
  <li><p>With (2) to get the data on initial page load would you </p>
  
  <ul>
  <li><p>a) include json/xml on initial page and run client side render on page load</p></li>
  <li><p>b) get it via a separate AJAX call on page load (+ simpler, - extra request and delay)</p></li>
  </ul></li>
  </ol>
  
  <p>I am focused on jQuery/Django but this question applies to other frameworks and AJAX libraries.</p>
  
  <p>This is a bit of a subjective quesiton, hope it doesn't step over the line! Thoughts?</p>