Comment Previewing Using Ajax

By Deane Barker on July 11, 2005

I’ve finally found a legitimate, value-adding use for Ajax — comment previewing.

On this site, you used to have to preview the comment on a separate screen, remember what you wanted to change, then go back to the main screen and make your changes (I’ve complained about this exact model with Movable Type post editing.)

Comment previewing on this site is now “Ajaxified.” If you click “Show Preview,” your current comment text is thrown at the server, processed according to the current comment settings, then returned and populated in a green box just under the submit buttons.

It seems to work well, but let me know if you have any problems.

(And if you’re going to test it — like I know you will — understand that you do not have to actually submit the comment. The process of posting the actual comment is unchanged, so preview all you want but please don’t cruft up the post with a bunch of “testing” comments. Once you’ve seen the Ajaxified preview, there’s nothing else to see, really.)

Update: Some people have asked for the script. It’s here, and it’s nauseatingly commented so it should be self-explanatory. And I’m no JavaScript ninja, so if something needs to be re-written, I’m all ears.

Gadgetopia

Comments

  1. IE6 show the following JavaScript error:

    Line: 55
    Char: 2
    Error: The data necessary to complete this operation is not yet available
    Code: 0
    URL: …post/4112
    The previewing does work however…

  2. This is pretty neat! I like it!

    What’s going on here?

    I just might implement this in my MT site! Thanks!

  3. IE6 show the following JavaScript error:

    Line: 55 Char: 2 Error: The data necessary to complete this operation is not yet available Code: 0 URL: ?post/4112

  4. But now my bandwidth has been exceeded so this is why the page is currently down. I’m sorry about this. I’m talking to my hosting company now to try and resolve it. It seems I completely underestimated the interest the page would generate.

  5. Its really helpful and thank you for giving me knowledge about the encryption i am doing my dissertation and i need to create a encrypted page and i hope this knowledge will help me a lot Regards

Comments are closed. If you have something you really want to say, email editors@gadgetopia.com and we‘ll get it added for you.