How is 618 sales champion made?Uncover the secret of e-commerce’s “invigorating” hundreds of millions of sales data>>>
CSRF token is invalid or lost, AJAX request page reports error (403 Forbidden) CSRF token exists, page response is CSRF verification failure, request is interrupted, after testing, the error is not that {% CSRF is not added in the form_ Token%} causes the refresh of DNS cache, but it still can’t solve the problem,
solve:
Check the setting configuration
‘django.middleware.csrf.CsrfViewMiddleware’,
Clear cookies in browser privacy, [invalid]
Refresh DNS [invalid]
Final solution:
Before reference JS, add Ajax startup item. There was a startup item before, but it failed for no reason
< script>
$.ajaxSetup({
data: {csrfmiddlewaretoken: ‘{{ csrf_ token }}’}
})
</ script>
Similar Posts:
- [Django CSRF tutorial] solve the problem of forbidden (403) CSRF verification failed. Request aborted
- Error encountered in Django: forbidden CSRF cookie not set
- [Solved] Forbidden (403) CSRF verification failed. Request aborted.
- Django admin Error: ‘WSGIRequest’ object has no attribute ‘user’
- [How to Solve] Laravel Ajax request error: 419 unknown status
- Django @csrf_exempt Cannot work in class view (Django @csrf_exempt not working in class View)
- CSRF verification failed. Request aborted [How to Solve]
- ERRORS: ?: (corsheaders.E013) Origin ‘*’ in CORS_ORIGIN_WHITELIST is missing scheme or ne…
- Django logs detailed error reporting information
- Vue + Django Project-Browser cross-domain error: Access-Control-Allow-Origin