3👍
try to add ensure_csrf_cookie decorator
from django.views.decorators.csrf import ensure_csrf_cookie
@ensure_csrf_cookie
def ajax_view(request):
and you don’t need {% csrf_token %} in template.html
Source:stackexchange.com
3👍
try to add ensure_csrf_cookie decorator
from django.views.decorators.csrf import ensure_csrf_cookie
@ensure_csrf_cookie
def ajax_view(request):
and you don’t need {% csrf_token %} in template.html