API REST request from another domain?
Posted: 26 Mar 2018, 08:51
Hi,
I'm developing an application in ColdFusion to manage mantis bt thought API REST but I have a problem with ajax requests.
If I making requests from the same domain where I installed mantis bt all requests work fine but when I try to make a request from another domain or the same domain with the different port the browser return "Access-Control-Allow-Origin" error.
I tried to add headers settings in API/rest/index.php and also in my ajax request but it doesn't work.
I'm developing an application in ColdFusion to manage mantis bt thought API REST but I have a problem with ajax requests.
If I making requests from the same domain where I installed mantis bt all requests work fine but when I try to make a request from another domain or the same domain with the different port the browser return "Access-Control-Allow-Origin" error.
I tried to add headers settings in API/rest/index.php and also in my ajax request but it doesn't work.
Code: Select all
var settings = {
"async": true,
"crossDomain": false,
"url": "http://localhost:8080/Mantis/api/rest/projects/",
"method": "GET",
"headers": {
"Authorization": "XXXXXXXXX-API-XXXXXXXXXXXXXx",
"Cache-Control": "no-cache",
"Access-Control-Allow-Origin": "http://dev.com:8500"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});