ajax - create html elements on the serverside VS get data as JSON and create tags with javascript -


i want create ajax search find , list topics in forum (just topic link , subject). question is: 1 of methods better , faster?

  1. get threads list json string , convert object, loop on items , create <li/> or <tr>, write data (link, subject) , append threads list. (jquery powered)

  2. get threads list wrapped in html tags , print (or use innerhtml , $(e).html())

thanks...

i prefer second method.

i figure server-side have either convert data json or html format why not go directly 1 browser understands , avoid having reprocess client-side. can adapt second method degrade gracefully users have disabled javascript (such still see results via standard non-js links.)


Comments

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -