0
votes

When i tired to get list title from developer site present in SharePoint online, i get CROS error. I have provided full permission to list and web in AppManifest.xml;

It is a simple ajax call that consume Sharepoint api rest services

Code:-

function ajaxcall() {
    var url1 = "https://xxxlll365.sharepoint.com/sites/devsite/_api/web/lists/getbytitle('xxx')/items?$select=Title";

    $.ajax({

        url: url1,
        dataType: 'json', //tired xml,jsonp, crossdoman:true [no big change]
        cros: true,
        success: function (result) {
            $("#div1").html(result);
        }
    });

Console Error XMLHttpRequest for https://xxxlll365.sharepoint.com/sites/devsite/_api/web/lists/getbytitle('xxx')/items?$select=Title required Cross Origin Resource Sharing (CORS)."Error"

Tired with angularJS and got same error as above !

2

2 Answers

0
votes

Try include in the header these options:

"Control-Allow-Origin","https://xxxlll365.sharepoint.com")

"Origin","https://xxxlll365.sharepoint.com")