0
Good night.
I usually use the MVC (Model-View-Controller) standard in projects, independent of the programming language.
In PHP the directory structure looks like this:
- assets
- css
- js
- img
- font
- model
- controller
- view
- session
- database
index.php
The question I have is how much in an AJAX call passing data to a PHP file and returning only database results using the parameters passed by the AJAX call as input.
Following the MVC model we can build the HTML directly in the controller or it would be safer to return only the values and have the HTML be rendered on the page using Javascript but leaving the client side to render the HTML on the page which can leave the side of the slow client.
If you know not only these two solutions, but others of receiving an HTML and render using the concept of MVC on a given page also accepted, what we want is to learn more about this subject.
The controller can use a view to format HTML, how to pass JSON type data to Javascript to render. But the controller does not format any HTML, this is the role of view.
– Papa Charlie
About leaving
lado do cliente lento
, recommend this question about Use JS to relieve PHP.– Papa Charlie
Thanks for the answers.
– Giancarlo Abel Giulian
It was not a direction as I would like to give, it became somewhat theoretical, but I was not sure if your doubt is about the Pattern or the implementation. Send the formatted HTML or format it with Javascript, I think this in the question I mentioned. You can further detail your question if you need.
– Papa Charlie