0

I want to request a sharepoint server with ajax but I get an CORS error : enter image description here

How can I solve this issue please

  $.ajax({
url: "http://myserver.com" + "/_api/web/Lists/GetByTitle('Documents')/items?$select=ID,Title,FileRef",
async: false,
crossDomain: true,
headers: {
    'accept': 'application/json;odata=nometadata'
},
complete: function(request) {
    console.log("Request: " + JSON.stringify(request, null, 4));
}, 
error: function(request) {
    console.log(JSON.stringify(request, null, 4));
}
4
  • 2
    Where are you doing the request from? – Mohamed Derhalli Feb 18 at 23:24
  • I’m doing the request from a computer in the same network and the same domain in the DNS – rezouane marimouttou Feb 20 at 6:42
  • @rezouanemarimouttou : set the crossDomain parameter to false. – A.k.A. Fritz Feb 20 at 18:57
  • @A.k.A.Fritz it's not working I get the same error. – rezouane marimouttou Feb 22 at 9:19
0

I believe that this article addresses your issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.