使用jQuery的beforeSend
回调添加带有身份验证信息的HTTP标头:
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa(username + ":" + password));
},
对jQuery和Ajax使用基本身份验证
使用jQuery的beforeSend
回调添加带有身份验证信息的HTTP标头:
beforeSend: function (xhr) {
xhr.setRequestHeader ("Authorization", "Basic " + btoa(username + ":" + password));
},