Im trying to create a JSON request and I have the below script, for some reason I don't get a response. Can anyone help with this?
I haver my token but I have no idea where I need to put it?
<script>
$.ajax(
'https://data.brightcove.com/analytics-api/videocloud/accounts/867903724001/report/?dimensions=video&format=json', {
type: 'GET',
dataType: 'json',
beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Bearer $token")
},
complete: function(resp) {
console.log(resp);
},
error: function(jqXHR, textStatus, errorThrown) {
console.log(textStatus);
}
}
);
</script>