I've a web app in Google Apps Script where I take a list of restaurants data(name, address, phone etc.) from Google Sheet and show them to my website through AJAX. Currently the resulted data are generated HTML created from Google Apps Script and I was thinking if there's any way to load the list faster. Then I thought of JSON, but I researched about it and found it's not that much of difference in loading time. Here is the HTML code that renders for each of the row data in sheet,
for (var i=0; i<rng.length; i++)
{
if (rng[i][0] != "") {
html += '<br><div class="row">
<div class="col s4">
<img class="circle responsive-img" src="img/logos/'+rng[i][0]+'.png" />
</div>
<div class="col s8">
<h5>'+rng[i][1]+'</h5>
<p><b>'+rng[i][2]+'</b></p>
<p>'+rng[i][3]+'</p>
<a class="waves-effect waves-light btn btn-sm red lighten-2" href="menu.html?id='+rng[i][0]+'">See Menu</a>
</div>
</div><hr><br>';
}
}
So for each row of data it creates that part of HTML code and returns the entire HTML in my website where I get it through jQuery AJAX. Now, my question is, is the above method better or should I use JSON to get the raw data only & render it through the client-side?