Answer the question
In order to leave comments, you need to log in
How to correctly transfer data from the backend to the front?
It is undesirable to mix business logic in php and the front, but how should it be right then? For example, I need to get some value from the database and transfer it to the front. What is the best way to do this?
Here I have an api that returns any information from the database. How to embed this information in html? Is it appropriate to access the api through JS and use it to embed information in html? In general, I would like to know how to correctly and appropriately connect the back and front.
Answer the question
In order to leave comments, you need to log in
hmmm. well, as if on the back, you make a call to your api, pull the data and format it right there in the same file into readable html
Using JS, pulling data and inserting it into the current page is only appropriate if you need dynamics caused by user activity (that is, there is already screw ajax)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question