Need help on sharepoint 2013 Rest API with Ajax Call.
I am trying to read the list items from publishing site to the team site. Both the sites are in different site collections.
The below code is worksfine in Internet explorer and not in Google chrome.
$(document).ready(function() {
$.support.cors = true;
$.ajax({
url:"http://icon.heart.com/WorkTools/Organization/Claim/_api/web/lists/getByTitle('Claims Links')/items?$top=200",
type:"GET",
headers:{"accept":"application/json;odata=verbose"},
dataType: "json",
success: function(data){ alert("pass")}
error: function(Data){ alert ("Fail");}
});
});
The response had Http Status code 401
. The error from the $.ajax
request is
Failed to load resource : the server responded with a status of 401(unauthorized)
Error 2:
XML HttpRequest Cannot load No 'Access-control-Allow-Origin' header is present on the requested resource. Oringin 'url' is therefore not allowed access.
I don't have access to the servers. I need to try only with Script editor on SharePoint 2013 page.