Generate final HTML in PHP or JS?

3

What is the best way, the best performance, to generate the final HTML. Direct on server-side or receive the database data and generate HTML on client-side ?

In the development of my current application, I came across this doubt, by receiving the data from the server and then generating much of the HTML in JavaScript.

    
asked by anonymous 11.06.2014 / 17:13

2 answers

4

Generate server-side. It is easier to trust that the server is fast than to rely on the speed of the client's computer.

The client computer may be old, have little memory or other limitations that you do not know. If another script on the page fails your page may get stuck.

Another aspect to take into account is SEO. If the site does not have content without running JS then the content indexed by the search engines will be poorer.

    
11.06.2014 / 17:15
0

It depends a lot on your need and the type of application you are creating.

I, in generating content, would use a lot of ajax if my application was a restricted area and did not need to index this content in google, for example.

    
11.06.2014 / 20:36