Does anyone know how the JSS API expects credentials from an ajax query? This is using a read-only account to gather machine information through a SharePoint page. The below code is in-place but every iteration returns an authentication error. (This doesn't include the text field where a user would enter a hostname). I know that the account is correct because I can successfully GET with curl, but not through ajax.
$.ajax({
type: "POST",
url: apiURL,
async: false,
dataType: "json",
contentType: "application/json; charset=utf-8",
processData: false,
headers: {
"Authorization": "Basic " + btoa("username:password")
},
success: function (){
alert('Thanks!');
}
});