Imagine a review site where users enter ratings and optionally short comments.
On each review page you've got many comments - these are displayed in a table at the end of the page (btw - not looking for datagrid type controls, far too simple for that)
I want to let users enter new reviews and update the page without a page refresh.(all simple stuff so far, this is not the question)
What is a good approach to generating for the page. Some thoughts :-
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.
Server side only output reviews as json/xml/whatever and render HTML dynamically on page load using javasript.
Downside - 'template' in javascript, hard for designers to customize + lack of 'content' on page.
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.
With (2) to get the data on initial page load would you
a) include json/xml on initial page and run client side render on page load
b) get it via a separate AJAX call on page load (+ simpler, - extra request and delay)
I am focused on jQuery/Django but this question applies to other frameworks and AJAX libraries.
This is a bit of a subjective quesiton, hope it doesn't step over the line! Thoughts?