When to use document.write()?
<p>I was told not to use <code>document.write()</code> by and SO member.  That innerHTML is better, or better yet, manipulate the DOM directly.</p>

<p>However, If I'm loading a page for the first time and there is content that is stored on a mysql table, and hence it will be converted to HTML, how can I do this if I don't want the server doing this task?</p>

<p>If the server did it then I could just have PHP code generate the html and place it where needed..but b.c. I want Javasrcript(client) to render the HTML I use this code (which is generated by php, but less processing time, as it does not create the HTML)</p>

<pre><code> &lt;script type='text/javascript'&gt;document.write(Arc.ViewHBookmark('google.com|http://www.google.com|Google||ideeli.com|http://www.ideeli.com|Ideeli||kikin.com|http://www.kikin.com|Kikin||lot18.com|http://www.lot18.com|Lot18||twitter.com|http://twitter.com|Twitter'))&lt;/script&gt;
</code></pre>

<p>This is how I have the client generate HTML on a page reload.  Embedded Javascript with a document.write().</p>

<p>Is there a better way to do this?  By better I mean a way that does not use document.write().</p>

<p>I can call a javascipt function that renders the HTML on the onload event, but how would I have access to the JSON data or similar(AML) in this case.</p>

<p>I could write it into the page..and then read it back in, generate the content, and write it back to the page...but this seems more inefficient than just using <code>document.write()</code></p>

<p>Is it O.K to use <code>document.write()</code> in this case?</p>

<p>If not, is writing structured data to the page and having javascript convert it to HTML considered good practice?</p>
