The request sent by the client was syntactically incorrect.客户端发送的请求是语法错误。
查了点资料,基本确认是由于数据传输的类型不统一导致的
但是重新检查了一遍数据库类型和前台页面接收的数据,并未发现异常。
原ajax中:
$.ajax({ async:false, type: "post", url: "/course/addCourse", dataType: "json", data:{ startTime:$("#start_time").val() }, success: function (data) { if (data.status == "success") { alert("成功!"); }else{ alert("失败!"); } }, error: function (XMLHttpRequest, textStatus, errorThrown) { } });
数据库中start_time数据类型为Date,前台打印为 2016-11-30,看似并没有问题,但依旧报错无法提交
解决方法:将数据用js转换成数据库时间格式即可
代码为:
data:{ startTime:Date($("#start_time").val()) }
注:也有从后台传到前台产生同样的错误,注意数据类型就好了。
看到有些解决方案提到有关Spring MVC数据绑定的知识,可以关注下这方面。