Support the ongoing development of Laravel.io →
Views Architecture
Last updated 2 years ago.
0

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?

Last updated 2 years ago.
0

This might help.

http://stackoverflow.com/questions/1284381/why-is-it-a-bad-practice-to-return-generated-html-instead-of-json-or-is-it

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.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.