解决django发送post请求出现403 Forbidden的问题

  1. ajax发送请求的代码如下:

    image.png

  2. django框架的代码如下(关键是引入红框的库文件):

    image.png

  3. 参考链接:

    1.他人的经验:https://blog.csdn.net/lucky404/article/details/79430633

    2.官网:https://docs.djangoproject.com/en/dev/ref/csrf/#ajax

猜你喜欢

转载自blog.51cto.com/12831900/2388182