It is quite easy to load HTML content from your custom URLs/Web services using JQuery or any other similar framework. I've used this approach many times and till now and found the performance satisfactory.
But all the books, all the experts are trying to get me to use JSON instead of generated HTML. How's it much more superior than HTML?
Is it very much faster?
Does it have a very much lesser load on the server?
On the other side I have some reasons for using generated HTML.
- It's simple markup, and often just as compact or actually more compact than JSON.
- It's less error prone cause all you're getting is markup, and no code.
- It will be faster to program in most cases cause you won't have to write code separately for the client end.
Which side are you on and why?
转载于:https://stackoverflow.com/questions/1284381/why-is-it-a-bad-practice-to-return-generated-html-instead-of-json-or-is-it