When I Get the document list from SharePoint site I get this error "401 (Unauthorized)" only in Google Chrome, but in IE it works. This is my code
function GetListItems() {
var siteURL = "http://localhost:8032/_api/web/GetFolderByServerRelativeUrl('Data%20Do')/File";
return $.ajax({
url: siteURL,
async: false,
method: "GET",
headers: {
"Accept": "application/json;odata=verbose",
}
});
}
I get this two error in Google Chrome:
OPTIONS "http:......" 401 (Unauthorized)
and
jquery-1.7.2.min.js:4 XMLHttpRequest cannot load http://localhost:8032/_api/web/GetFolderByServerRelativeUrl('Data%20Do')/Files. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8032' is therefore not allowed access. The response had HTTP status code 401.