Simple Ajax Commenting Script
April 20, 2006 6:44 PM   Subscribe

I'm looking for a simple Ajax commenting script that will allow commenters on a blog-like site to submit comments without actually leaving the page. I've found the one for Wordpress - but it seems to be a little too specialised for WP templates to be easily adaptable for my site's needs (though I will if I have to). Any links would be much appreciated.
posted by Dag Maggot to Computers & Internet (5 answers total)
 
There's a show/hide comment form thing from scriptygoddes that I've had success with before. No leaving the page necessary.
posted by rhapsodie at 7:15 PM on April 20, 2006


Thanks rhapsodie - but I don't think that's quite it.

The problem I have is that people are watching video, and I'd like them to be able to submit comments while the video is playing without interrupting the playback. So the form should submit, come back and display all of the comments with the user's new comment tacked on the end. all this without *actually* submitting and destroying the playback.
posted by Dag Maggot at 8:04 PM on April 20, 2006


Have you considered an iFrame instead of AJAX?

If the comment listing and entry form are in the iFrame, it can refresh within itself and not mess up the video playback.

I think this might be an easier way to solve your problem, and more cross-browser compatible.
posted by twiggy at 10:45 PM on April 20, 2006


Ajax should be able to do this fairly easily. You didn't mention what blogging system you use, if any; you're right to suspect that the Wordpress solution probably won't work for you, but I imagine the big issue is not necessarily the innate functionality but the fact that it's probably wrapped up in a Wordpress plugin.

If you want to write your own script from scratch, submitting forms using POST via Ajax will come in very handy, though theoretically you could use the GET method as well. Basically you would only have to make one Ajax call, when you post the comment to the server; if the server responds affirmatively, you can just use the information you've already collected from the user to pop the new comment into the bottom of the stack using straight DHTML. You could take some shortcuts by using available Ajax JS libraries (Prototype is one option); the hardest part at that point would be writing the server-side script that would record the comment in your blog's database and spit out some XML indicating success or an error.

If none of what I just wrote made any sense to you, then twiggy's option is also a good one (though personally I've never like IFRAMES). It will involve finding a way to seperate your comment form/display from the actual blog post, though. A lot of blogs used to pop up comment windows a couple of years back; that's the sort of page you would place in the IFRAME.
posted by chrominance at 11:29 PM on April 20, 2006


This AJAX tutorial was the one that was simple enough that it actually stuck in my head.
posted by misterbrandt at 6:30 PM on April 22, 2006


« Older A Grave Problem with HTML Entities.   |   Plato denied Greek inventiveness? Newer »
This thread is closed to new comments.