What is the best way to render html with ajax?
way1:
initially have less html and put more dynamic html via ajax.
way2:
initially have more html and put less dynamic html via ajax.
for e.g my html
<div id="div1">
<div>
<p id="p1">hello</p>
</div>
<div>
way1:
initial html
<div id="div1">
</div>
dynamic html
<div>
<p id="p1">hello</p>
</div>
way2:
initial html
<div id="div1">
<div>
<p id="p1"></p>
</div>
</div>
dynamic html
hello
this example is small but i hope you are getting the context.So the question is which is best for front end performance. and additionally does the browser repaints the whole page when we dynamically add html via javascript?.