127.0.0.1:8000/post-1/like 403 (Forbidden)
$(function(){
$('body').on('click', '.article-like', function(){
if ($(this).hasClass('fancybox-login-popup')) {
return false;
}
var entryId = parseInt($(this).attr('data-id'));
var hash = $(this).attr('data-hash');
var sign = parseInt($(this).attr('data-sign'));
var rating = $(this).parent().children('b');
$.post('{% url 'posts:add_like' pk=post.pk %}', { entryId: entryId, sign: sign, hash: hash }, function(data) {
if (data.error === undefined) {
if (data.likesCount > 0) {
var t = '+' + data.likesCount;
var c = "positive";
} else if (data.likesCount < 0) {
var t = '–' + Math.abs(data.likesCount);
var c = "negative";
} else {
var t = '0';
}
if (sign === 1) {
var v = "voted-positive";
} else {
var v = "voted-negative";
}
rating.text(t);
rating.parent().removeClass("negative positive").addClass(c);
rating.parent().removeClass("voted-negative voted-positive").addClass(v);
} else {
showTip(data.error, 'error');
}
}, 'json');
return false;
});