I'm creating an API to connect with JIRA- TEMPO.
My request is working with the plugin in chrome "ARC" and its returning results. But When I send it via jQuery ajax its showing the 'Access-Control-Allow-Origin' header is present on the requested resource.
I have searched all of the solutions provided in StackOverflow it's not working.
jQuery(document).ready(function () {
$('.test').on('click', function () {
$.ajax({
method: 'GET',
type: 'Content-type',
dataType: 'application/json',
url: 'https://domain.atlassian.com/rest/tempo-timesheets/3/worklogs?dateFrom=YYYY-MM-DD&dateTo=YYYY-MM-DD',
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "Basic " + btoa('username:password'));
xhr.setRequestHeader("Access-Control-Allow-Origin", "*");
}
}).done(function (msg) {
console.log(msg);
}).fail(function () {
console.log("error");
});
});
});
Kindly help to solve this problem. Is there any way to achieve this in PHP?