how to pass authorization header in get request jquery code example
Example 1: jquery ajax basic authentication
var username="username_here";
var password="password_here";
$.ajax({
type: "GET",
url: "myapi.php",
dataType: 'json',
headers: {
"Authorization": "Basic " + btoa(username + ":" + password)
},
success: function (result){
console.log(result)
}
});
Example 2: how to send authorization in header of HTTP GET using ajax
AJAX Authorization