Answer the question
In order to leave comments, you need to log in
Sending request twice?
Why does it send twice?
[30/Jul/2015 23:00:17]"GET /send_like/?pk=36&user_id=3 HTTP/1.1" 200 1
[30/Jul/2015 23:00:17]"GET /send_like/?pk=36&user_id=3 HTTP/1.1" 200 1
$(document).on("click", ".likes", function (e) {
e.preventDefault();
var postid = $(this).data("postid");
$.get('/send_like/',{"pk":postid,"user_id":userId}, function(e){
$('.like_count[data-postid="'+postid+'"]').show();
$('.likes[data-postid="'+postid+'"]').hide();
$('.dislikes[data-postid="'+postid+'"]').hide();
});
});
<span class="likes" data-postid="{{one_post.pk}}" >
<i class="glyphicon glyphicon-thumbs-up"></i>
</span>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question