I need to get the data from javascript ajax call. I have username and password. But I am getting 401 unauthorized error. My ajax call is like:
$.ajax({
url: ‘lhttps://api.unbounce.com/accounts/******/sub_accounts](https://api.unbounce.com/accounts/ ****** /sub_accounts “Link: https://api.unbounce.com/accounts/792612/sub_accounts”)’,
type: ‘GET’,
data: {
“basic_auth_username”: ‘******************************’,
“basic_auth_password”: ‘’***"
},
dataType: ‘application/json’,
success:function(data) {
console.log(“ajax request success”, data);
},
error: function() {
console.log(“ajax request failed”);
}
});
Please help me.
Thanks.