wbotelhos/raty — Issue #26: update stars after ajax call issue
Author: pcout
Created: 2011-12-08 19:34:38+00:00
State: open

Hello,

I have a issue.

I have two instances of the plugin applied to 2 divs.
One is for the global rating (average rating from all users that submitted a rating) and the other one is for the user rating of the displayed article.

I´m using ajax to store the rating of the user and then using the success function i want to update on the fly the global rating.
It´s all going ok except for one thing.
The target displays the average correctly, but the stars of the global ratings are not updated. They maintain the last value before the user submitted the vote). They correctly appear only if i refresh the page.

What am i doing wrong ?

I´m using the following code:

$('#artigo_rate_global').raty({
start: ,
target:'#target'
});
$('#artigo_rate_user').raty({
start: ,
target:'#target_user',
click: function(score){
var idr = $(this).attr("name");
var ida = ;
.ajax({
type: "post",
url: "rate.php",
dataType: "html",
data: {ida:ida, idr:idr, score:score},
//data: dataString,
success: function(data){
$('#target').html(data);
$('#artigo_rate_global').raty('start', data);
$('#artigo_rate_global').raty('readOnly', true);
$('#artigo_rate_user').raty('start', score);
$('#artigo_rate_user').raty('readOnly', true);
}
});
}
});