What are the pros and cons of generating dynamic pages with javascript vs doing it in PHP?
As an example, I want to display certain records from some database in a table and I'm considering the following approaches:
- Use Javascript to get some response in JSON from some PHP page, then dynamically build the table in Javascript.
- Write some PHP in the page which will make the query and iterate through the result set echoing the table markup.
What are the pros and cons of each approach?