I am using the code below to send XML to a repository. It's giving me the following error:
XMLHttpRequest cannot load http://example.com/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8080' is therefore not allowed access. The response had HTTP status code 401.
Even though I have set the header to allow Access-Control-Allow-Origin
, it's still throwing the error.
var request = new XMLHttpRequest();
var url = 'http://example.com/';
if(request) {
request.open('PUT', url, true);
request.withCredentials = true;
request.setRequestHeader('Access-Control-Allow-Origin', '*');
request.send(XML);
}
Aucun commentaire:
Enregistrer un commentaire