From 83c2390f729a8e4fe250e70297f47d127f699b2a Mon Sep 17 00:00:00 2001 From: Koen Bolhuis Date: Tue, 9 Oct 2018 22:32:16 +0200 Subject: [PATCH] Send POST request to imaginary endpoint for helpful votes --- frontpage/rateables/js/voting.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/frontpage/rateables/js/voting.js b/frontpage/rateables/js/voting.js index 55247aa..8b68f90 100644 --- a/frontpage/rateables/js/voting.js +++ b/frontpage/rateables/js/voting.js @@ -3,10 +3,26 @@ $(function() { $(".vote-up").click(function() { var reviewId = $(this).attr("data-review-id"); + var data = { + 'csrfmiddlewaretoken': csrftoken, + 'helpful': true + }; // Vote up + $.post( + '/api/postings/reviews/' + reviewId + '/helpful_vote', + data + ); }); $(".vote-down").click(function() { var review = $(this).attr("data-review-id"); + var data = { + 'csrfmiddlewaretoken': csrftoken, + 'helpful': false + }; // Vote down + $.post( + '/api/postings/reviews/' + reviewId + '/helpful_vote', + data + ); }); }); \ No newline at end of file