Example of jquery ajax call with authorization bearer token
$.when($.ajax({
url: 'url',
method: 'get',
datatype: 'json',
headers: {"Authorization": "Bearer " + localStorage.getItem('token')}
})).then(function( response, textStatus, jqXHR ) {
console.info(response);
var obj = response;
console.info(obj)
}).catch(function(err){
$.each(err.responseJSON, function(index, value){
console.info(index, value);
})
})