AJAX - Comment Box with [ Javascript jQuery JSON PHP MySQL ] - Step by Step How to Guide - Part 18

preview_player
Показать описание
In this last and final tutorial of this series, I talk about making sure that when a new comment is inserted to the list, then the user cannot immediately delete the same comment which they have made, due to the fact that we havent set an event handler on newly inserted objects.

When we first loaded the page, we looped through all delete-btn's and attach an event handler. Therefore the only thing which we need to do once we have inserted a new comment into the list, is to run the same loop once again, to reattach new event handlers.

So we basically take the code which we wrote before and place it into a function so as we then dont have to rewrite the same code.

Finally I then talk about how to only allow the user which has entered the comment be able to delete it. As you know at the beginning we made 2 input elements of type hidden holding the userId and userName. We use this information to act as the cookie which would be stored on the client when the user has logged in.

Once this has been done, all works just fine.
Рекомендации по теме
Комментарии
Автор

5 years ago this series of tutorials is uploaded and still helping people. Good work man. I watched all the videos and I was looking for this all over the internet dug into youtube to couldn't this perfect. wasted a whole month here and there and you helped just in one day. Thank you.

ankursyal
Автор

Thank you very much. I have learned A LOT from you. I have coded from start to finish. Some videos I have watched two - three times until becomes totally clear. 

nemanjastankovic
Автор

Thank you, David for sharing the knowledge and teaching us in such details.You are a very gifted teacher. This has been very helpful to me & learned a lot. I am so humbled by your closing remark, with your eagerness to help, teach, share. Bless you:))

pall
Автор

Just finished the series. Was interested on how the json works between client and server, and you helped me understand it. Thank you so much

truthmachine
Автор

I thank you! though you can make it less complicated but i learnt of code and thinking methods of you, you sir deserve a medal and a cup of coffee ;)

OusamaEsbel
Автор

Thank you so much for the tutorial!!! Very professional easy to follow and just cool!! I followed and completed the hole playlist in one sitting!! Thanks again!

kenteastwood
Автор

Loved it ! Thanks you a lot you seems to enjoy what you are doing, im not commenting often but this series made me learn a lot of things ! Thank you david you rock !

xjontv
Автор

i watched every single videos of this tutorial and it work perfectly :)

mokongka
Автор

great work man!!it was so informative, I watched all the 18 tutorials it was awesome, continue your good work.

VenuGopal-vrzg
Автор

Hey David, thank you so much for your tutorial! The way you explained it was perfect! There are 3 things what you could add to this tutorial:

1. a reply function for a comment 
2. an edit function with the date when it was edited
3. rating function for a comment sothat rated comments will be listed on top.

gfreeman
Автор

This it will be a good challenge for me, just want i need it for my website, thank you very much Sir!

andreescudragos
Автор

Thank you David. I have learned a lot from this playlist. I have to learn from your ajax tutorial and also learn object oriented coding too. 

PeterReginald
Автор

Tutorials were great...Had small problems but with some adapting of the code got it working.. Thanks..

nialloconnor
Автор

It 's a good tutorial for me quickly to learn the basic things of ajax and jquery
and also the uses of json

richard
Автор

Thanks a lot, I really liked this tutorial series, especially your way to taking care of client script first before server side also with good code housekeeping . Looking forward to learn more from you.

I wish you make a tutorial to how to use bootstrap with jquery.

mishalalsharekh
Автор

Very nice tutorial man really cool. You have helped me understand a lot of the basis of php! Thank you!

kevinpatel
Автор

You've saved my life! ^^thank you! you're a great teacher ^^

TheGoldDandelion
Автор

Yes I agree with omar. Please make login/signup tutorials with cookies especially if it's actually needed for this comment box tutorial. Otherwise, it's like a waste of time for beginners because we can't make them ourselves and we won't be able to make use of this comment tutorial... Nobody's rushing you to finish all these tutorials in one day so you could take your time and add the necessary stuff we need to know

Other than that very nice tutorial, it took me hours to finish them all and almost got me crazy trying to find out why it wasn't working near the end but I made it work. Thanks a lot!

cherrymontesa
Автор

Thanks for this tutorial ! was kind of hard in the middle but eventually it worked perfectly !

GaiaKH
Автор

Thanks David for you r invaluable videos. I will become a coder before long. ...like your accent (coming from a yank).

samhaas