I am trying to use CORS with JQUERY in order to retrieve data through a web API , however, I keep getting an authentication error and from the research I have done, apparently I need to set the server http response header first. How do I do this JQUERY/MVC please?
$(document).ready(function () {
var request = $.ajax({
type: 'GET',
url: "https://api-eu.myconnectwise.net/v2017_1/apis/3.0/service/tickets/13024/",
headers: { 'Authorization': 'Basic ' + btoa('#######' + '+' + '################" + ':' + "###############") },
dataType: "jsonp",
xhrFields: {
withCredentials: true
}
});
request.done(function (data) {
console.log(data);
});
});