in following code rank variable not updating after click event. the click event also contains data attr change anybody may point out problem data attr change is in ajax update success function.
//php
<div class="logo_rank" data-id="<?php the_ID(); ?>" data-rank="<?php echo $rank_num; ?>">
<?php
$disable_star = 5 - $rank_num;
for ($i = 0; $i < $rank_num; $i++) {
echo '<i class="fa fa-star" id="star' . $i + 1 . '" style="color:#0170B9;" aria-hidden="true"></i>';
}
for ($i = 0; $i < $disable_star; $i++) {
echo '<i class="fa fa-star" id="star' . $i + $rank_num + 1 . '" style="color:#d3d3d3;" aria-hidden="true"></i>';
}
//java
$(".fa-star").click(function(e) {
var id = $(e.target).parents(".logo_rank").data('id');
var rank = $(e.target).parents(".logo_rank").data('rank');
var starclicked = $(this).index() + 1;