I'm looking for a voting script/widget (preferably jQuery), but not a star rating one, one with +1 and -1 options like this (admire my profesionnal MSPaint skills ^^) :
Anyone know about one ?
Thanks a l开发者_如何学JAVAot !
you can do this using ajax.
Recommend you set up some ajax listener page and ping with some userID and vote (1,-1) or something along those lines.
This assumes you have a userID and login credentials etc. Or you can register it against their IP or something.
Basically:
ajaxListener.php?ID=123456&vote=1
send the ajax listener, and then have the total vote count update when the ajax is complete (have your ajax listener echo back a string of data lets say): voteTotal=10~totalVote=95
Once you read this with ajax, split it with javascript: var split1=responseText.split("~"); var voteScore=split1[0]; var voteCount=split1[1];
not tested but this should work and complete what you are thinking.
ajax: http://api.jquery.com/category/ajax/
$.ajax({ url: "ajaxTool.php?id="+idVariable, context: document.body,
success: function(){
$(this).addClass("done");
}});
精彩评论