javascript - Accessing local network site giving 401 -


i'm trying create plugin check values hosted on local site. auth on page done via windows authentication.

so trying create xhr request, still gave me 401

// method 1 function get_information(link, callback) {     var xhr = new xmlhttprequest();     xhr.open("get", link, true, "user","password");     xhr.onreadystatechange = function () {         if (xhr.readystate === 4) {             callback(xhr.responsetext);         }     }; } 

same ajax request (with webtoolkit.base64.js)

// method 2 function make_basic_auth(user, password) {   var tok = user + ':' + password;   var hash = base64.encode(tok);   return "basic " + hash; }  function get_info2(url){   var auth = make_basic_auth('user','password');   $.ajax({       url : url,       method : 'get',       beforesend : function(req) {           req.setrequestheader('authorization', auth);       }   }); } 

so impossible fetch data in via extention, or doing wrong?


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -