let baseUrl = "http://www.hahhs:6602/appApi/LkdG6t";
//let xhrs = new XMLHttpRequest();
$.ajax({
type:"POST", // 请求头
url:baseUrl+"/user/login", // 请求路径
dataType:"json", //返回格式
ContentType: "application/json",
headers: {"Authorization":"Basic "+"YWRtaW5BcGk6WE5LSg=="},
/*beforeSend:function(xhr){
//设置自定义头部
xhr.setRequestHeader("Authorization","Basic "+"YWRtsaW5BcGk6WE5LSg==");
},*/
data:{
/*"name":'黄',
"gender":"男",
"age":22*/
"password": "21232f297a57ewea5a743894a0e4a801fc3",
"phoneNumber": "17811231663"
}, //传递的参数
success:function(res){
console.log(res)
}, //接口请求成功 返回的函数
error:function(err){
console.log(err)
}//接口请求失败函数请求的函数
})
注:这只是自己的笔记 不使用请放过