jquery submit不提交的解决办法:1、打开相应的表单代码文件;2、将button的type改为submit;3、修改按钮id即可。

本文操作环境:windows7系统、jquery3.2.1版、DELL G3电脑
jquery submit 不提交怎么办?
jquery submit()不能提交表单的解决方法
今天写表单提交的时候需要增加一个确认提示,所以没有使用submit按钮提交,改用jq的submit(),然后问题了
1 <script>
2 $(function () {
3 $("#submit").click(function () {
4 var start = '@(Model.annualRate_beginDate?.ToString("yyyy-MM-dd"))';
5 var end = $("#annualRate_endDate").val();
6 var val = $("#annualRate_rate").val();
7 layer.confirm('请确认所填写的信息是否正确?<br/>开始时间:' + start + '<br/>结束时间:' + end + '<br/>年利率:' + val, { icon: 3, title: '提示' }, function (index) {
8 $("#form").submit();
9 layer.close(index);
10 });
11 });
12 })
13 </script>
点击提交按钮出现确认提示,但是确认后就没反应了
但是将button的type改为submit却又能提交
jQuery 1.12.4是jQuery 1.x系列的最后一个正式稳定版本,由jQuery团队于2016年发布。该版本主要面向需要兼容旧版浏览器环境的网站和Web应用,尤其适用于仍需支持Internet Explorer 6、Internet Explorer 7、Internet Explorer 8等老旧浏览器的项目。
于是上jQuery API查找原因,看到以下这段文字顿时明白了:
Additional Notes: Forms and their child elements should not use input names or ids that conflict with properties of a form, such as submit, length, or method. Name conflicts can cause confusing failures. For a complete list of rules and to check your markup for these problems, see DOMLint.
大概意思是表单和其子元素不宜用一个表单的属性的属性作为name或id的名称,如submit, length, 和 method等,否则会产生冲突,名称冲突可能就会导致这种情况。
原来是因为按钮id设为了submit
接下来只要将id改了就没问题了
推荐学习:《jquery视频教程》










