I have been writing my website, front-end: html, JS, jquery and css, back-end: php mysql. However my php files only contain php and mysql code. Is this a really bad thing? In what situation should PHP files contain html/javascript?? Currently my php files are just there to receive request and response with array of information. I just dont understand why people would put front-end stuff in back-end, is it for security?
Tell me more
×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.
|
migrated from codereview.stackexchange.com 2 days ago
This question came from our site for peer programmer code reviews.
I think that it a good practices to separate front-end to back-end. I am supposing that you are using AJAX to communicate with the back-end, and it is the reason why you are not using HTML/JavaScript in your PHP files. If you have to create a dynamic web page without AJAX, you have to write some HTML code in your PHP file. Doing every front-end operations with JavaScript imply that these operations are done by the browser. If you prepare the HTML on the server side, the browser just render the code without extra effort. | |||||||||||||
|