Im using Ajax to send values ββto a PHP script that writes some value to the database:
$.ajax({
type: "POST",
data: "action=vote_down&id="+$(this).attr("id"),
url: "vote.php",
success: function(msg) {
$("span#votes_count"+the_id).fadeOut();
$("span#votes_count"+the_id).html(msg);
$("span#votes_count"+the_id).fadeIn();
}
});
As you can probably tell from action=vote_down, a script to vote script.
I already forbid the user to vote more than once, registering a vote there against this username and identifier in vote.php, and if there the username and identifier are already in the database against the same record, I do not add the vote to the database.
I personally believe that a database request for each page load to check whether a user has already been voted can be quite intense, there are many places to vote on one page.
, , , , - vote.php, , .
?