I came across this topic: Use of basic authorization in JQuery ajax
I have the same problem. When accessing page directly with browser I can see in the request headers the Authorization header. But I can't send this header with Ajax. I need this header, because I'm writing webserver for embedded platform, and the parse function search for it.
My code is:
$.ajax
({
type: "GET",
url: "http://192.168.1.233/relay",
username: username,
password: password,
data: {
relay: "on",
},
timeout: 2000,
success: function (result){
console.log("success: " + result);
}
});