I have been having trouble getting back a specific issue from Jira via Ajax/Jquery. Everytime I get a 401 error code
Here is my code for more context:
<ac:plain-text-body>
<button>Get Issue</button>
<script type="text/javascript"> AJS.toInit(function() {
var button = AJS.$("button")
button.click(function(){
AJS.$.ajax({
url: "https://jira.int.mycompany/rest/api/2/issue/issue-ID",
type: "GET", beforeSend: function(xhr) {
xhr.setRequestHeader("Authorization", "Basic XXXXXXXXX");
xhr.withCredentials = true;
},
dataType: "json",
success: function(msg){
console.log(msg);
},
error:function(msg){
console.log(msg);
}
});
})
});
</script>
</ac:plain-text-body>