Am I right in thinking that the former is rendered on the server and the latter in the browser, therefore for layout switching it can all be done locally with the data having already been received in one tidy JSON package?
This might help.
If you want to have those data in memory so you could work with them in end user's frontend, then JSON seems to be a better choice. In contrast to that, if you only need to present the result, generated HTML might save you some time and resource.
In the example you have, resource used to generate HTML is done in server, comparing to the second method, you will be leveraging some of the computing power to client's computer to do the calculation.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community