1

I am trying to build a separate app in which i would like to update a list which is available in on-premise sharepoint in my organization. How can I do it using javascript.

Sample Ajax Call I tried so far:

        var url = "http://xxx:14950/sites/iManage";
        var listname = "Tracker";

        $.ajax({
            url: url + "/_api/web/lists/getbytitle('" + listname + "')",
            method: "GET",
            headers: {
                "Accept": "application/json; odata=verbose"
            },
            success: function(data) {
                // Returning the results
                console.log(data);
            },
            error: function(data) {
                console.log(data);
            }
        });

The response I am getting is

XMLHttpRequest cannot load http://xxx:14950/sites/iManage/_api/web/lists/getbytitle('Activity%20Tracker'). No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://127.0.0.1:57284' is therefore not allowed access. The response had HTTP status code 401.
Sonali
  • 2,223
  • 6
  • 32
  • 69

0 Answers0