In Postman this Post request runs just perfect:
var settings = {
“url”: “https://webservicesp.anaf.ro/AsynchWebService/api/v5/ws/tva”,
“method”: “POST”,
“timeout”: 0,
“headers”: {
“Content-Type”: “application/json”
},
“data”: JSON.stringify([{“cui”:2864518,“data”:“2021-03-29”}]),
};
$.ajax(settings).done(function (response) {
console.log(response);
});
But when I try to run it from from our WordPress web-store, from a .js file when leaving a field:
$(’#billing_cui’).blur(
function(){…
I get:
Access to XMLHttpRequest at ‘https://webservicesp.anaf.ro/AsynchWebService/api/v5/ws/tva’ from origin ‘https://…’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.
webservicesp.anaf.ro/AsynchWebService/api/v5/ws/tva:1 Failed to load resource: net::ERR_FAILED