0

below is my code where i am using XMLHttpRequest but it is showing below error, can anyone help me out with the issue.

error 1 : open.html:24 OPTIONS https://proxy.api.deepaffects.com/text/generic/api/latest/sync/text_recognise_emotion?apikey=xAur1Q9uSgipes2jnCBSTzPj8mJn4LP9 404 (Not Found) (anonymous) @ open.html:24 error 2 : Failed to load https://proxy.api.deepaffects.com/text/generic/api/latest/sync/text_recognise_emotion?apikey=xAur1Q9uSgipes2jnCBSTzPj8mJn4LP9: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'null' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute. open.html:15

var data = JSON.stringify({
  "content": "it is not good"
});

var xhr = new XMLHttpRequest();
xhr.withCredentials = true;

xhr.addEventListener("readystatechange", function () {
  if (this.readyState === 4) {
    console.log(this.responseText);
  }
});

xhr.open("POST", "https://proxy.api.deepaffects.com/text/generic/api/latest/sync/text_recognise_emotion?apikey=xAur1Q9uSgipes2jnCBSTzPj8mJn4LP9");
xhr.setRequestHeader("content-type", "application/json");

xhr.send(data);
Dee_wab
  • 1,171
  • 1
  • 10
  • 23

0 Answers0