JQuery Voting issue
I voting to news author in my site with this jQuery
code.
<script type="text/javascript">
$(function() {
$(".vote").click(function()
{
var id = $(this).attr("id");
var name = $(this).attr("name");
var dataString = 'id='+ id ;
var parent = $(this);
if (name=='up')
{
$(this).fadeIn(200).html('<img src="dot.gif" />');
$.ajax({
type: "POST",
url: "up_vote.php",
data: dataString,
cache: false,
success: function(html)
{
parent.html(html);
}
});
}
else
{
$(this).fadeIn(200).html('<img src="dot.gif" />');
$.ajax({
type: "POST",
url: "down_vote.php",
data: dataString,
cache: false,
success: function(html)
{
parent.html(html);
}
});
}
return false;
});
});
</script>
This worked ! After voting show alert box for thanks or result. Now if in one page 9 posts (开发者_Python百科 example ADMIN posted ) for voting 9 show 9 alert box !
How to fix this ?
You can use this one: http://www.technabled.com/2011/02/pulse-lite-reddit-ajax-up-down-voting.html Disclosure: I am the developer.
精彩评论