This time we are set to improve Comment framework without invigorating page with jquery, Ajax and Php. In this requisition we had actualized with gravatarimage. It’s is helpful and basic just a few lines of code. Examine the live demo impact.
javascript code.
http://jquery.js
$(function() {
$(“.submit”).click(function()
{
var name = $(“#name”).val();
var email = $(“#email”).val();
var comment = $(“#comment”).val();
var dataString = ‘name=’+ name + ‘&email=’ + email + ‘&comment=’ + comment;
if(name==” || email==” || comment==”)
{
alert(‘Please Give Valid Details’);
}
else
{
$(“#flash”).show();
$(“#flash”).fadeIn(400).html(‘Loading Comment…’);
$.ajax({
type: “POST”,
url: “commentajax.php”,
data: dataString,
cache: false,
success: function(html){
$(“ol#update”).append(html);
$(“ol#update li:last”).fadeIn(“slow”);
$(“#flash”).hide();
}
});
}return false;
}); });
C
omment.php
Contains HTML code here class timeline li{display:none}
<ol id=”update” class=”timeline”>
</ol>
Name
Email
commentajax.php
Contains PHP and HTML code.
<?php
if($_POST)
{
$name=$_POST[‘name’];
$email=$_POST[’email’];
$comment=$_POST[‘comment’];
$lowercase = strtolower($email);
$image = md5( $lowercase );
mysql_query(“SQL Comment table insert statement”);
}
else { }
?>
<li class=”box”>
<img src=”http://www.gravatar.com/avatar.php?gravatar_id=
<?php echo $image; ?>”/>
<?php echo $name;?><br />
<?php echo $comment; ?>
</li>
I wanna say thanks for posting this good information. Keep up the great job. I’ll subscribe to your weblog also. thnx!
hello
Hi Aaine,
Greetings!
Please let us know, how we can help you?
Thanks & Regards
Team Vivacity
add replay functionality in this