Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.
Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.
django提交表单的时候报错
RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.
提示form的action地址最后不是/结尾的,而且APPEND_SLASH的值是Ture
将from的action地址改为/结尾的就可以了
或者
修改settings:APPEND_SLASH=False
下面是我使用Jquery的两种提交方式:
get
post
<script>
function submitForm1() {
<!--获取值-->
var u=$('#username').val();
var p=$('#password').val(); $.ajax({
url:'/ajax2.html',
type:'GET',
data:{username:u,password:p},
success:function(arg){
console.log(arg);
}
})
}
function submitForm2() {
var val1=$('#value1').val();
var val2=$('#value2').val();
console.log(val1+val2)
$.ajax({
url:'/ajax3.html/',
type:'POST',
data:{value1:val1,value2:val2},
success:function(arg){
$('#res').val(arg)
}
}) }
Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.的更多相关文章
- Django:提交表单报错:RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have A
Django:提交表单报错:RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you ...
- Django ajax方法提交表单,及后端接受数据
前台代码: {% block content %} <div class="wrapper wrapper-content"> <div class=" ...
- Spring MVC中 提交表单报错400
背景: 在写SpringMVC表单提交的代码的时,在最后点击提交的时候总是会出现400的错误 原因: 主要原因就是表单提交的数据和对应实体类的属性无法完全匹配 解决方案: 查看我们提交的数据是否完全和 ...
- django使用ajax提交表单数据报403错解决方法
只需要在.ajaxSetup方法中设置csrfmiddlewaretoken即可 $.ajaxSetup({ data: {csrfmiddlewaretoken: '{{ csrf_token }} ...
- JQuery中button提交表单报TypeError: elem[type] is not a function jquery
错误: TypeError: elem[type] is not a function jquery 解决: 出现这种现象的原因是,提交的表单中,有标签的name,有以submit命名的 name中不 ...
- Laravel使用Ajax提交表单报419 unknown status错误的解决方法
1.在head标签中间添加一行meta标签:<meta name="csrf-token" content="{{ csrf_token() }}"> ...
- Yii框架用ajax提交表单时候报错Bad Request (#400): Unable to verify your data submission.
提交表单报400错误,提示 "您提交的数据无法验证"原来是csrf验证的问题,因为表单是自己写的,在Yii框架中,为了防止csrf攻击,对post的表单数据封装了CSRF令牌验证. ...
- JQuery - 提交表单
[JavaScript] JQuery异步提交表单与文件上传 Jquery.form.js是一个可以异步提交表单及上传文件的插件. 文档地址:http://jquery.malsup.com/form ...
- ajax post提交form表单 报400错误 解决方法
昨天晚上做项目遇到了一个奇怪的问题,我用ajax提交一个form表单,后台Java方法用的是一个实体接,但是他根本不进方法体中,直接给我一个400的错误,一开始我以为是我路径的问题(尴尬),结果直接访 ...
随机推荐
- Confluence 6 PostgreSQL 输入你的数据库细节
在 Confluence 的设置安装向导中,将会指导你 Confluence 如何连接到你的数据库.请确定选择 "My own database". 使用 JDBC 连接(默认) ...
- SpringBoot的yml配置文件
1.在src\main\resources下创建application.yml配置文件 spring: datasource: driver-class-name: com.mysql.jdbc.Dr ...
- requireJs require.config公共配置
//场景:让require.config配置文件成一个公共文件,每个页面引用这个公共配置 //方式一样例: require.config({ baseUrl: (function () { var p ...
- laravel 5.6
compact() 建立一个数组,包括变量名和它们的值 打印结果: starts_with() 函数判断给定的字符串的开头是否是指定值
- 计蒜客31452 Supreme Number(找规律)
A prime number (or a prime) is a natural number greater than 11 that cannot be formed by multiplying ...
- 2017-2018-2 20165206 实验二《Java面向对象程序设计》实验报告
2017-2018-2 20165206 实验二<Java面向对象程序设计>实验报告 一.实验报告封面 课程:Java程序设计 班级:1652班 姓名:韩啸 学号:20165206 指导教 ...
- How does exercise keep your brain young?
Exercise may protect the brain from disease and dementia as we age, but the mechanisms behind its be ...
- Python深度学习案例1--电影评论分类(二分类问题)
我觉得把课本上的案例先自己抄一遍,然后将书看一遍.最后再写一篇博客记录自己所学过程的感悟.虽然与课本有很多相似之处.但自己写一遍感悟会更深 电影评论分类(二分类问题) 本节使用的是IMDB数据集,使用 ...
- Android Https双向认证 + GRPC
keywords:android https 双向认证android GRPC https 双向认证 ManagedChannel channel = OkHttpChannelBuilder.for ...
- How to disable Microsoft Compatibility Telemetry
Issue: How to disable Microsoft Compatibility Telemetry (CompatTelRunner.exe)? Option : Disable Mi ...