Detailed documentation and working demo here.
<div class="container">
<input type="radio" name="example" class="rating" value="1" />
<input type="radio" name="example" class="rating" value="2" />
<input type="radio" name="example" class="rating" value="3" />
<input type="radio" name="example" class="rating" value="4" />
<input type="radio" name="example" class="rating" value="5" />
</div>
$('.container').rating();
$('.container').rating(function(vote, event){
// console.log(vote, event);
});
$('.container').rating(function(vote, event){
// write your ajax code here
// For example;
// $.get(document.URL, {vote: vote});
});