javascript vs. php : pros and cons for code development
<p>If a user refreshes a page I need to send the data using php as it accesses a mysql table.</p>

<p>If the user adds content, I don't want to run an AJAX call "first" as I can simply and immediately update the DOM, and then send a one-way ajax call to store it in the mysql table.</p>

<p>So on a referesh I have PHP creating my XHTML and sending it to the Browser.</p>

<p>On user input, I have the DOM update immediately followed by ajax call to put it in the mysql table.</p>

<p>Thing is I have to write code in JS and PHP for each user action that modifies the page.</p>

<p>Should I have the data sent to the Javascript for entry into the DOM and not do less with it in the PHP.  What are the tradeoffs from taking user input and converting it to the UI with javascript vs. php?</p>

<p>Should  I offload as much as possible to the client to reduce server load?</p>
