I think this is the main idea. You can fill in the details / adapt as necessary to your markup and model / actions.
$('.upvote').click( function() {
$(this).addClass('highlight');
$(this).nextAll('.downvote:first').removeClass('highlight');
$.post( '<%= Url.Action( "vote", new { id = Model.ID } %>', { vote: 'up' } );
});
$('.downvote').click( function() {
$(this).addClass('highlight');
$(this).prevAll('.upvote:first').removeClass('highlight');
$.post( '<%= Url.Action( "vote", new { id = Model.ID } %>', { vote: 'down' } );
});
source
share