JSFiddle - React, Tailwind, and code Playground
JavaScript
getUser ();
function getUser () {
var user = 'user';
var password = 'test';
var auth = "Basic " + btoa(user + ":" + password);
var urlApi = 'https://apidev.bear2b.com/v2.9/users/me';
$.ajax({
processData: true,
type: 'GET',
url: urlApi,
headers: {"Authorization": auth},
success: function(data){
var user = data;
$('body').html('<code>'+JSON.stringify(user)+'</code>');
},
error: function(data){
$('body').html( data.responseJSON.error + ' ' + data.responseJSON.description );
}
});
}