after reading all data from mysql database print out another text

Well, I have a loop that select from database: candidate_name, candidate_surname, candidate_faculty and print them out. With Ajax help there is two buttons - “Like” and “Dislike”. If you click any of this button the name goes hidden and updated in database (“Like” means +1 vote, “Dislike” -1 vote)

Is there any php script, ajax script, or smth else, that after last name is checked and “Like” button is pressed - the page prints out the text: “Thanks for voting!”

So, for example, I have candidates:

[name] [surname] [faculty] [like or dislike with +/-]
Abbey Smith DMF +/-
Alice Holmes MMF +/-
Dave MacAlister HF +/-

After I click “Like” on Abbey,
Name disappears and remains only Alice and Dave

How to make after Dave is disappear - instead of his name I see message: “Thanks for voting!”

Anything done on the browser is going to be JavaScript.

Let’s say that the names are in labels. from there you would use a javascript/ jQuery function to determine something was clicked and based on the id of the sender, you would replace the text.

Can you please write the script for me? In JS/jQuery I’m new so I will not be able to write myself.

Or any help how to detect last candidate ID, and after it’s gone - the message appears?

Sponsor our Newsletter | Privacy Policy | Terms of Service