function vote_up(){
$("a.vote_up").click(function(){
the_id = $(this).attr('id');
$(this).parent().html("<img src='" + home + "/img/spinner.gif'/>");
$("span#votes_count"+the_id).fadeOut("fast");
$.ajax({
type: "POST",
data: "action=vote_up&id="+$(this).attr("id"),
url: home + "/ajax.php",
success: function(msg)
{
$("span#votes_count"+the_id).html(msg);
$("span#votes_count"+the_id).fadeIn();
$("span#vote_buttons"+the_id).remove();
},
error: function(msg) {
$.msgBox({ title: "Uyarı", content: 'Oylama Sırasında Hata Meydana Geldi!'});
}
});
});
}
function vote_down(){
$("a.vote_down").click(function(){
the_id = $(this).attr('id');
$(this).parent().html("<img src='" + home + "/img/spinner.gif'/>");
$.ajax({
type: "POST",
data: "action=vote_down&id="+$(this).attr("id"),
url: home + "/ajax.php",
success: function(msg)
{
$("span#votes_count"+the_id).fadeOut();
$("span#votes_count"+the_id).html(msg);
$("span#votes_count"+the_id).fadeIn();
$("span#vote_buttons"+the_id).remove();
},
error: function(msg) {
$.msgBox({ title: "Uyarı", content: 'Oylama Sırasında Hata Meydana Geldi!'});
}
});
});
}bu kodda ne hata var ?ilk tıkladığımda tetiklemiyor, ikinci tıkladığımda tetikliyor. Bu sefer ajax dan sonuç 2 kez dönüyor.
Yani makalenin oylama sonucu 11 ise.
2 kere tetikliyor 9 a düşüyor.