0

这是代码,我在 chrome 控制台中收到如下错误: 无法加载 URL: 预检响应无效(重定向)

$(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>');
      }

    });
});
4

0 回答 0