ajax发送请求的代码如下:django框架的代码如下(关键是引入红框的库文件):参考链接: 官网:https://docs.djangoproject.com/en/dev/ref/csrf/#ajax 转载于:https://blog.51cto.com/12831900/2388182