Forbidden (CSRF token missing or incorrect.):

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: