for looping in jquery
in my php I have such code in a while loop...
$rate = "<div class=\"example-".$id." \"></div></br>Post id: <span
class=\"example-rating-".$id."\">".$id."</span>";
Let say the $id loop from 1 to 100, and I have a jquery code which is...
$(document).ready(function () {
for (var i = 1; i < 101; i++) {
$('.example-' + i + '').ratings(3).bind('ratingchanged', function
(event, data) {
$('.example-rating-' + i + '').text(data.rating);
var a = $('.example-rating-' + i + '').html();
$.post('count.php', {
rate: data.rating,
wallpostid: a
}, function (data) {
alert(data);
});
});
}
});
for the value A I get the null value, but if i replace
var a = $('.example-rating-50').html(); //let say the wallpostid is 50
it only can pass the value 50 to count.php Is my for looping do wrong at
the jquery?
No comments:
Post a Comment