C# Tips and Tricks > Ajax Rating System
- Download source files - 160 Kb
- Online demo - Ajax Rating
- Discussions/Comments/Suggestions
- Complete Article on "Ajax Rating System"
Introduction
This article describes an ASP.NET web module along with some chunks of Javascripts and ...Ajax to create a Rating System. This can be added /customized for any table to add a rating/score module. I was quite amazed, when i first saw the capability of rating multiple items at amazon website without refreshing the page. That nice piece of functionality followed me like destiny, till i needed to implement it in a web application.
Well ! putting it in a live scenario needs much more than just javascript. I started with a bit of frenzied hacking. To understand how exactly it works, by scanning the javascript from online asynchronous rating websites. That was just the beginning, on the way i learned much more than earlier imagined. Here is the result of the effort.
The target was to create a cross browser rating/score system like amazon or better:
- Rating: User should be able to Rate a record (1-5)
- Accuracy: Number of votes and total score should be accurate and saved and should not be lost in calculations
- Real time: Rate/score should be displayed after rating instantly
- Reusable: It should be easily plugged into any table for reusability
- Avoiding multiple ratings: Basic mechanism to avoid multiple ratings by the same user
- Best approach: Compare the pros and cons for both Amazon and Ajax approach
- Security: Few words
* By Amazon Way i meant it can simulate the rating system like the amazon website, it does not claims that this is the way amazon is doing there rating.
In Action
To hold your interest, here is how it will look (for single record), once completed

Article History
- May 25, 2006: First published.
- May 26, 2006: Added Pros and Cons for both approach
- May 30, 2006: Added security as suggested by leppie and HyperX
- June 05, 2006: Added details on cookies and sessions to avoid multiple ratings
