Very Simple Rating System - AJAX via jQuery, JSON, Владимир Комаров, 12.07.2009:

User I -


User II -


User III -



	$(".rate").each(function() {
		var userID = $(this).attr("id");
		var randomNumber = Math.floor(Math.random() * 1000000); // to prevent caching - MS IE
		$.getJSON("vsrs-rate.php", {id : userID, act : "get", rand : randomNumber}, function(data) {
			var votes = "#votes-" + data.id;
			$(votes).html(data.votes + " гласа");
		});

		$(this).bind("click", function() {
			var userID = $(this).attr("id");
			var randomNumber = Math.floor(Math.random() * 1000000); // to prevent caching - MS IE
			$.getJSON("vsrs-rate.php", {id : userID, act : "set", rand : randomNumber}, function(data) {
				if (data.votes == 0) {
					var status = "#status-" + data.id;
					$(status).html("Вече сте гласували!").fadeOut(2000, function() { $(this).html(" ").fadeIn("0"); });
				}
				else if (data.votes > 0) {
					var votes = "#votes-" + data.id;
					$(votes).html(data.votes + " гласа");
				}
			});
		});
	});