jQuery Star Rating plugin - select in callback causes infinite loop
- by Ian
Using the jQuery Star Rating plugin everything works well until I select a star rating from the rating's callback handler. Simple example:
$('.rating').rating({
...
callback: function(value){
$.ajax({
type: "POST",
url: ...
data: {rating: value},
success: function(data){
$('.rating').rating('select', 1);
}
});
}
});
I'm guessing this infinite loop occurs because the callback is fired after a manual 'select' as well. Once a user submits their rating I'd like to 'select' the average rating across all users (this value is in data returned to the success handler).
How can I do this without triggering an infinite loop?