【发布时间】:2011-12-04 20:24:35
【问题描述】:
我有一个 Django 站点,使用 5 星评级系统进行投票(我使用 django-ratings),我想存储使用 AJAX 调用的用户的投票。
在客户端,我有一个 JavaScript 函数向 URL 发送 GET 请求:
$.ajax({
url: url,
success: function(data) {
alert('Load was performed.');
}
});
在服务器端,我有设置 cookie 的代码:
def vote(request, slug, rating):
# Some irrelevant code...
response = HttpResponse('Vote changed.')
response.set_cookie('vote', 123456)
return response
问题是浏览器中从未设置过cookie。
我做错了什么?
谢谢!
【问题讨论】:
标签: django cookies django-voting