Skip to content

Instantly share code, notes, and snippets.

@emilepetrone
Created July 6, 2011 18:30
Show Gist options
  • Save emilepetrone/1067977 to your computer and use it in GitHub Desktop.
Save emilepetrone/1067977 to your computer and use it in GitHub Desktop.
<script>
$(".vote").click( function() {
var votes = $(this).parent().find('.vote_num').attr('votes');
$.post(
'{% url vote %}', {
"id":this.id,
}, function(data) {});
this.className = "voted";
votes = parseInt(votes) + 1;
$(this).parent().find('.vote_num').text(votes);
return false;
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment