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

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));
  • 2
    Where are you doing the request from? Commented Feb 18, 2021 at 23:24
  • I’m doing the request from a computer in the same network and the same domain in the DNS Commented Feb 20, 2021 at 6:42
  • @rezouanemarimouttou : set the crossDomain parameter to false. Commented Feb 20, 2021 at 18:57
  • @A.k.A.Fritz it's not working I get the same error. Commented Feb 22, 2021 at 9:19

1 Answer 1


I believe that this article addresses your issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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