I am using jquery raty plugin, there is a click event which I am using to send rating data and then return new rating from database, but I cant figure out how to update returned rating, my code:
$('.starrating').raty({
number:10,
score: function() {
return $(this).attr('data-rating');
},
click: function(score, evt) {
var contentid = $(this).attr('id');
$.post('/main/rating.php',{score:score, contentid:contentid },
function(data){
//alert(data+' Score = '+score);
$(this).data('rating',2);
});
}
});
I tried with below but no success;
$(this).data('rating',2);
Thanks for any help.