Reputation: 4938
Lets say i have json which contains informations. What would be the best way to put the informations on site. Creating elements via js like (this is just part im interested in , inside ajax call) var div=document.creteElement("div"); var text=document.createTextNode("bla"); var img=new Img; img.src=json1.img; img.onload=function(){ div.appendChild(text); div.appendChild(img); } or putting them "in" like
body.innerHTML+="<div><p>blabla</p><img src='json1.img'/></div>"`
which one of there is better/faster/more efficient , or is there any better way how to put content into site via ajax? Also how does big sites that load tons of data from server handle this? Tons of data would take a lot of time to load
Upvotes: 0
Views: 2387
Reputation: 2799
Ok, I understand now. To render content from ajax you have 3 choices:
Upvotes: 2