This time, we are making a Simple AJAX Commenting System. It will feature a gravatar integration and demonstrate how to achieve effective communication between jQuery and PHP/MySQL with the help of JSON.
2. Facebook Style Wall Posting and Comments System using jQuery PHP and Ajax.
Facebook style wall posting and commenting system. Try a new reloaded version of demo which is almost similar to facebook style. My previous facebook style posting system was not so much like original facebook posting style and also there is no commenting system So I created this tutorial again to complete the commenting system and I tried my best to give my dear users a complete posting script with comments system. Facebook is now a days top social networking site.
So I have created some tutorials similar to facebook. Youtube style rating is also very popular tutorial on this blog. Hope you like it.
In this tutorial we will create multi level comments. You must have seen comments on youtube and that they have levels depending on who replied to who. That’s exactly what we will build.
I’ve seen that most of scripts online execute query to check if comment has child elements. Let’s say you have 10 comments and each of them has 1 child element. You would execute 1 query to get all those 10 comment (first level) and then for each of them to check if it has child. And then for each child to check if that comment has childs to. That would be 1 + 10 + 10 = 21. That’s 21 query for nothing. It’s easier to do it with just one query that will load all comments and then to structure them in an multidimensional array. For that purpose we will use walker class that you can download here and read tutorial how we made it here. So let’s start working on it.
Continuing with a rather ‘Ajax’ theme after the last few tutorials on here i thought I’d go the full way and show you how to create a 140 character php and ajax comments tool. We’re using jQuery to perform the ajax request and create the user experience. You can download all the files needed to get this working at the bottom of this post, it includes the MySQL file to create the database table.