下面这个是原生表单提交
下面是ajax的post请求
axios的提交结果
为什么ajax的post请求会报错500?
问题出现的环境背景及自己尝试过哪些方法
在Vue中使用的,jquery的ajax。
相关代码
// 请把代码文本粘贴到下方(请勿用图片代替代码)
this.queryParams.password='c92f37aa72d2fa44a2c25b615b363fdb'; console.log(this.queryParams.password='c92f37aa72d2fa44a2c25b615b363fdb')
var str = 'username='+this.queryParams.username+'&imageCode='+this.queryParams.imageCode+'&password='+this.queryParams.password;
console.log(str)
$.ajax({
type: "post",
dataType: "json",
url: "/api/authentication/form" ,
data: str,
success: function (data) {
console.log(data)
},
error : function() {
alert("异常!");
}
});
this.$axios.post('/api/authentication/form',
str
)
.then((response) => {
console.log("提交成功!, 刚才提交的内容是:" + response)
},
(response) => {
alert("出错了")
}
)
你期待的结果是什么?实际看到的错误信息又是什么?
报错
实在开不出来JQuery的ajax为什么会报错
5XX 这特么是后端问题啊!
这要是后端写的代码压根不支持
X-Requested-With
你搁前端找一辈子也找不到原因。@Infogami
