2

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 ^^) :

alt text

Anyone know about one ?

Thanks a lot !

3rgo
  • 3,115
  • 7
  • 31
  • 44
  • did you try google? http://ad1987.blogspot.com/2009/02/reddit-style-voting-with-php-mysql-and.html – Alec Smart Aug 30 '10 at 14:38
  • professional mspaint skills? http://www.youtube.com/watch?v=uk2sPl_Z7ZU :) – Alec Smart Aug 30 '10 at 14:39
  • @Alec Smart : Yeah I know, I suck compared to this guy ! Anyway, I've already seen some voting block like the one I doodled, but I can't remember the website. I've searched google for 2 hours now, with all the keywords I could think of, and I didn't find anything close, except for the page you gave me... – 3rgo Aug 30 '10 at 14:42
  • http://stackoverflow.com/questions/490969/stack-overflow-reddit-voting-system-in-php – Alec Smart Aug 30 '10 at 14:48

1 Answers1

0

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");
  }});
jason m
  • 6,519
  • 20
  • 69
  • 122