I had to do some JS trickery to implement a preview feature by posting via AJAX without having to reload the current page.
The problem I ran into was displaying the output into an iframe.
Assuming the HTML is:
<iframe id='preview-iframe' src="about:blank"></iframe>
We can use this jQuery command to inject the HTML into the iframe.
$('#preview-iframe').contents().find('html').html(data);
Update (18/01/13): Thanks Nikri for the IE about:blank fix!