I have a Django website using a 5-star rating system for voting (I use django ratings ), and I would like to keep users voting with AJAX calls.
On the client side, I have a JavaScript function that sends a GET request to the URL:
$.ajax({ url: url, success: function(data) { alert('Load was performed.'); } });
On the server side, I have the code setting the cookie:
def vote(request, slug, rating): # Some irrelevant code... response = HttpResponse('Vote changed.') response.set_cookie('vote', 123456) return response
The problem is that the cookie is never set in the browser.
What am I doing wrong?
Thanks!
source share