View Full Version : AJAX/PHP Comment Script
XT Gohan
Sep 1st 2008, 2:01 pm
I was wondering if there was a stand-alone "posting comment script" for AJAX. Not for blogs, wordpress or anything like that, I am trying to use this on website just so that people can comment on my website without having to reload or refresh a page.
I also don't mind paying someone for a script of this caliber either, if it is possible please let me know
Panzer
Sep 1st 2008, 9:51 pm
Well its fairly simple to create.
You need to attach a button click (the submit button) to an event, and for it to return false to the form doesn't submit. Then send a request with AJAX..
I have one that i made with jQuery for sale if you want..
xlcho
Sep 1st 2008, 11:24 pm
It's pretty simple, but it depends on your site's database and structure. I mean, sending an AJAX request is easy, but without knowing what to execute on the server is a problem :) I assume you just need to insert the comment into a database. Give a little bit more info, cause all I can tell you for now is you need a textarea and a button..
koolman
Sep 1st 2008, 11:46 pm
You may use the UpdatePanel of KoolAjax, it is as simple as bellow:
<?=KoolScripting::Start();?>
<updatepanel id="comment">
<content>
<?php
if (isset($_POST["txtComment"])
{
//Add new comment to the database
}
//Out put all available comments from database here
?>
<input type="textarea" id="txtComment" name="txtComment"/>
<input type="button" id="btnPost"/>
</content>
<triggers>
<trigger elementid="btnPost" event="onclick"/>
</triggers>
</updatepanel>
<?=KoolScripting::End();?>
How does it work?
First load, [all the comments] + [a comment textarea] + [a post button] is output to screen.
When btnPost is clicked, UpdatePanel will do callback and post txtComment to server without reloading the page.
At server-side, if $_POST["txtComment"] exist then add new comment to comment list in database.
Out put all available comments including new one to client. The client will update change from server.
Pretty simple. You do not need any Javascript code to make this thing work.
Hope that help.
PS: If you think KoolAjax is nice, please help me to vote for KoolAjax on Hotscripts: http://www.hotscripts.com/Detailed/82735.html :)
webinsane
Nov 8th 2009, 9:57 am
Our company created currently the best comment script (http://www.cubescripts.com/add-a-comment-script.php) in the market (considering the features). The idea behind it is that can be easily integrated into existing websites.
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.