module.exports ={
_callAPI: function(url,method,data,target){
let token = "santhi" + ":" + "santhi";
let hash = btoa(token);
console.log(hash);
$.ajax({
url: BASEURL + url,
method: method,
data: data,
processData: true,
dataType: 'json',
headers: {
"Authorization" :"Basic " + hash,
"Content-Type" :"application/json"
},
success: (data,textStatus, jqXHR) => {
target('success', data);
},
error: (jqXhr,textStatus,error) => {
target('error',jqXhr,textStatus,error);
}
});
},
}
我正在添加授权作为标题。但我没有得到任何东西。有没有其他方法来授权base64编码。
提前致谢