When it comes to a highly AJAX-enabled website, the content of the web page can be updated partially using AJAX. This basically involves changing HTML tags or parts of the web page.
So, when faced with this situation, we must decide between two approaches:
The server can render the HTML tags on the server side and return them in the XmlHttpRequest response. The browser's JavaScript then simply changes the innerHTML of the container with the XHR response;
Alternatively, the server can return data in JSON format. The browser's JavaScript would render the HTML based on the JSON and then change the innerHTML of the container accordingly.
Which approach is better from a performance standpoint?
By performance, I mean the perceived performance by the end user, which is influenced by factors such as the time spent on the server side, time spent on the network, and on the client-side browser.