title: Web Application: Preprocess and send all items in one page load, or separate the items into separate client requests?
body: <p>I have been tasked with supervising the rewrite/modernization of our firm's ancient (1990s!) PHP application. Of course, I approach this task with both excitement and trepidation. I have spent weeks researching frameworks, libraries, benchmarks and the like.</p>
  
  <p>One of the main functions of this system is to load data items from the backend MySQL db and present them to frontend users. Which items display is a complex issue, but it could any combination or number of items. Say, for example, like a catalog. A user might view one item, browse categories of items, or search for items. Additionally, there are many restrictions and conditions on visibility, and other specific item level data.</p>
  
  <p>My specific question is:</p>
  
  <p>**What are the experts' thoughts on loading and displaying the item data? In terms of page load times, server strain, or any other factor... Should I 
  (A): have the server compute all of the output data and then send it to the client (browser) in the initial page request? </p>
  
  <p>(B): Or, should I output a basic page skeleton along with a list of IDs in a javascript variable, and then have the client request each item separately and then have a responder send back the (JSON?) data and have the client populate pages?** </p>
  
  <p>What I am seeking here is some programmers' wisdom, on what has worked best. I don't want advice that tells me to switch from PHP to another language, or that I need to run my own tests. I am not asking anyone to write any code for me. I simply want your wisdom / advice on which way would be better and why, or factors would make a case for one approach vs the other.</p>
  
  <p>While scenario (A) seems old school to me, and less flexible. I think it may be faster for the frontend users. If my server as max-optimized and cached-out, shouldn't this (still) be the most efficient way?</p>
  
  <p>Option (B) seems cooler and more 'modern' but is there any point to this approach? What would I gain, except for perhaps some front-end JavaScript and dynamic templating skills? It seems that each page load could require dozens of additional requests, as well as extra client side processing, which to me is against the latest page speed optimization advice from the big guns.</p>
  
  <p>Thanks for your time.</p>