关于Spring Security+axios 自定义成功失败处理返回null值的原因【已解决】
 
                
关于Spring Security+axios 自定义成功失败处理返回null值的原因记录
- 问题1:首先排除HTML 或者javascript 表单或者 异步提交的字段名错误:**username**
- axios 异步提交正确方案
 
问题1:首先排除HTML 或者javascript 表单或者 异步提交的字段名错误:username
Java的基本都是驼峰命名要小心被坑
axios 异步提交正确方案
注意:
 axios({
 headers: {‘Content-Type’:‘application/x-www-form-urlencoded’},
 method: “post”,
 url: “http://localhost:8080/submitLogin”,
 params: { username:document.getElementById(“username”).value, password:document.getElementById(“password”).value},
 }).then(function (response) {
 if(!response.data.success){
 alert(response.data.error);
 window.location.href=“http://localhost:8080/loginAction”;
 }else {
 alert(response.data.message);
 window.location.href=“http://localhost:8080/admin”;
 }
 })
 
