Can anyone provide guidance on how to handle https
+ cross-domain
URL using $http
?
I managed to solve my issue using $.ajax, but I prefer using $http because I have an $http interceptor set up to automate certain processes.
I've checked out related posts [link1, link2, link3] but none of them have resolved my issue.
I've attached a screenshot of my console for reference.
The strange thing is that $http is using the OPTION method instead of POST as specified.
Below is a snippet of my code:
$http({
method: 'POST',
url: '/HearingCentre',
data: {
Type: ['P', 'V']
},
success: function (res) {
console.log(res);
d.resolve(res);
},
error: function (res) {
console.log(res);
d.reject(res);
}
});
NOTE: I'm utilizing an $http interceptor that appends the base API URL to the specified URL.
$.ajax version
$.ajax({
method: 'POST',
crossDomain: true,
url: 'https://ahtstest.hearing.com.au/services/api/HearingCentre',
data: {
Type: ['P', 'V']
},
success: function (res) {
console.log(res);
},
error: function (res) {
console.log(res);
}
});
Does anyone have a solution to this issue?