Deadlines,
I have a problem to consume a third-party Webservice, when trying to consume it by java script the return I get is:
XMLHttpRequest can not load link . Response to preflight request does not pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' link ' is therefore not allowed access.
However when trying to consume the same by postman I can get the desired response, that a Json, to consume the same is necessary to pass in the header a login and password, as follows:
Authorization: xxxx
To consume webservise I created the following script:
function getListaWebService(url){
$.ajax({
'url': url,
Type: "GET",
dataType: "json",
headers: {
"Authorization": "xxxx " + geraBase64("xxxx", "yyyy")
}
}).done(function (objJson){
console.log("objJson", objJson);
}).error(function (err) {
console.log("err", err);
}); }
What did I do wrong, if it is cross domain problem, how can I solve it by JS or java?