Есть много сценариев там , но это не так уж сложно сделать самостоятельно.
Ранее я использовал jQuery (для обработки AJAX) и небольшой PHP-скрипт. Например, некоторый псевдокод:
// Some checking for recent votes from this user is appropriate here
if (isset($_POST['voteType'], $_POST['postId']) && $user->loggedIn) {
// insert vote into database if not already inserted
echo json_encode(array('error' => false));
} else {
// bad request/hack attempt
echo json_encode(array('error' => true, 'message' => 'Bad parameters sent'));
}
, а затем немного jQuery:
$('#upVote').click(function() {
$.post('vote.php', {voteType: 'up', postId: 42}, 'updateIcon(data, textStatus)', 'json');
});
function updateIcon(data, textStatus) {
// If error = false highlight the upvote icon
// else show the error message returned
}
jQuery.post