这是代码,我在chrome控制台中收到错误如下: 无法加载网址 预检的响应无效(重定向)
$(document).ready(function(){
var username = "username";
var password = "password";
$.ajax({
type:'GET',
url:'URL',
dataType:'json',
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa(username + ":" + password));
},
success: function(data){
console.log(data);
$('#keepithere').append('<p>'+data+'</p>');
}
});
});