16 lines
429 B
JavaScript
16 lines
429 B
JavaScript
/**
|
|
* Simple (ugly) code to handle the comment vote up/down
|
|
*/
|
|
var $container = $('.js-vote-arrows');
|
|
$container.find('a').on('click', function(e) {
|
|
e.preventDefault();
|
|
var $link = $(e.currentTarget);
|
|
|
|
$.ajax({
|
|
url: '/comments/10/vote/'+$link.data('direction'),
|
|
method: 'POST'
|
|
}).then(function(response) {
|
|
$container.find('.js-vote-total').text(response.votes);
|
|
});
|
|
});
|
|
|