2 ms·
JSON is better IMHO. HTML is pretty ugly and using innerHTML is an extremely bad idea. Better to send data as JSON, and manipulate the DOM if you need.
by axod 18y ago
JSON is better IMHO. HTML is pretty ugly and using innerHTML is an extremely bad idea.
Better to send data as JSON, and manipulate the DOM if you need.
- simonw 18y agoWhat's wrong with using innerHTML?
- senthil_rajasek 18y agoPrimarily, memory leaks You can find better reasons here http://ajaxian.com/archives/the-problem-with-innerhtml http://ajaxian.com/archives/the-problem-with-innerhtml
- axod 18y agoSeveral bugs and issues, some things don't work, issues with tables... Not to mention the fact it just looks ugly and horrible IMHO. Setting innerHTML to a string, in order to deserialize a partial HTML fragment is just not nice. The DOM methods are actually pretty well thought out, and provide a far better interface to manipulate the document.