1
The question seems obvious, but I would like to understand it in more technical terms. In my application I need to place objects in an HTML template for user viewing. I have two options and I would like to know which is the most efficient.
1º - Send only objects for AJAX request and mount the HTML template in JAVASCRIPT and place it in the interface.
2º - Assemble the HTML template in PHP send for AJAX request and just put it in the interface.
I am currently using 2nd, but I think the first option is more efficient. I would like to know if I am right and the reason why.
This last paragraph you wrote is just the question point, me mounting the card in PHP and returning, each object already mounted on the card gets approximately 1315 characters and the return being only the pure object it gets much less characters, but javascript will take the trouble to structure and put in its proper place in html. From what you quoted there is no exact calculation of cost or rule that should follow, I understood right ?
– LSA
Yes, you understand. I believe my answer was a bit confusing, but in short: relieving back or front? , the more data passed to the front the longer, is it worth leaving everything to the back? put on the scale, test both shapes and see which one is the best in your case
– Costamilam
There is also the question of compatibility, your users' browsers have JS support? Is it active? Another thing that can interfere is how is your front, it is already heavy with various animation effects or with some other task?
– Costamilam
It has support yes, the interface is super light. I understood. Vlw thank you very much.
– LSA