C# Tips and Tricks >  Ajax Rating System


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:

  1. Rating: User should be able to Rate a record (1-5)
  2. Accuracy: Number of votes and total score should be accurate and saved and should not be lost in calculations
  3. Real time: Rate/score should be displayed after rating instantly 
  4. Reusable: It should be easily plugged into any table for reusability
  5. Avoiding multiple ratings: Basic mechanism to avoid multiple ratings by the same user
  6. Best approach: Compare the pros and cons for both Amazon and Ajax approach
  7. 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 

   Rating system in Action

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 

Comments / Suggestions



screen  Add a Comment 
Subject  User  Date 
Last Visit: 1:45:30 AM, Thursday, March 11, 2010


You can also reach me at: here

Rate This Page