// 进行登录操作
form.on('submit(login)', function (data) {
alert(":!@3123123213");
let params = data.field;
console.log(params.password);
$.ajax({
url:'http://localhost:8089/user/login',
type:'post',
data:JSON.stringify(params),
contentType: "application/json;charset=UTF-8",
xhrFields: {withCredentials: true},
crossDomain:true,
success:function(data){
console.log(data);
},
error:function () {
layer.msg("密码修改失败")
}
})
return false;
});
先确保后端接口支持跨域,ajax跨域可以试下这个
$.support.cors = true;
$.ajax({
.......
});