Bootstrap

post方法提交报400错误 xhr.send( ( options.hasContent && options.data ) || null );解决办法

问题:post报400错误

三种解决方法

一.参数有没有拼写错误

如:questDescribe写成questDscribe

 $.post("saveQuestion",{topicId:type,quesName:title,questDscribe:content},function (data) {
                    if(data=1){
                        alert("提交成功");
                    }
                });

错误会显示为:
在这里插入图片描述

这个种错误,很简单

二.后台没有确定Post方法、@RequestParam

参考代码

@RequestMapping(value = "saveQuestion",method = RequestMethod.POST)
    @ResponseBody
    public boolean SaveQuestion(@RequestParam String topicId,@RequestParam String quesName,@RequestParam String quesDescribe){
       

三.Jquery版本太高或者太低

一般情况下,不会下很多版本JQuery
可以使用BootCDN在线JQuery调试版本,选择合适的版本
https://www.bootcdn.cn/jquery/

;