views:

3607

answers:

2

I'm want to implement thumbs up and down rating system in my web app using jquery. Please tell me some plug-in or code how to implement the thumbs up and down rating system in my website, please share links or resources.

Thanks

+2  A: 

here is a style with thumbs up and down using JQuery with a Backend in PHP/MySQL.

Link to code (You can try the demo online and all the source code is there)

Daok
This very good, thanks +1 for you :)
Prashant
+8  A: 
Jonathan Sampson
Indeed, this is a distinctly AJAX feature, most of the code being on the server side.
Noldorin
The code your posted is very easy to hack... you put the score in the Javascript lol? Someone could just put 10000 in the javascript and have a boost of vote :P
Daok
Daok, my code isn't for production. Of course it's not secure. It's meant to convey an idea, not a full solution.
Jonathan Sampson
On the server side you would limit scores to "1" or "-1", and your attempt to send 1,000 across will fail.
Jonathan Sampson
much as this looks like it will work, you're using a GET request to change data on the server. The arguments are varied, but strictly I think you should use $.post here
David Archer
As with all things, server-side validation would be a must. Note that he *did* say "do not use as-is".
Cal Jacobson
@David, I went with GET for a fall-back incase scripting isn't available. It work work either way.
Jonathan Sampson
fair play, sir :-) I wasn't really trying to 'down' you. Just pointing out so the asker can be aware for future reference.
David Archer
@David - No worries. I didn't feel like you were "downing" me :)
Jonathan Sampson
ah the irony in context of 'downing' :-D
David Archer
If I am blocking the user to vote only once on the basis of IP address (for gust users) and userid (for registered users), which means one person can vote one time up or down, user also has the option that he can later change there vote, means if i have voted up then after sometime i can vote it down also, so my up vote will be removed and down vote will be counted. Is there any security measures in this scenario ?
Prashant
Prashant, As long as you check to see if the user has already voted, you should be safe. If they voted, and their previous vote is different than the one they're now sending, then update their record. If they haven't voted, insert a new record. If they've voted, and it's the same value, bake them a cake :) Just be sure to always check for previous activity.
Jonathan Sampson
Ok, thanks @Jon.
Prashant