使用 jQuery's beforeSend 回调方法添加 HTTP header with the authentication information:http://api.jquery.com/jQuery.ajax/
beforeSend:function(xhr){
xhr.setRequestHeader ("Authorization","Basic XXXXXX");},
$.ajax({ url: url, type: 'GET', dataType: 'text', beforeSend: function (xhr) { xhr.setRequestHeader ("Authorization", "Basic MzQ2NTUyNTYxQHFxLmNvbToxMjM0cXdl"); },