我正在尝试构建一个单独的应用程序,我想在其中更新我的组织中的内部部署共享点中可用的列表。我怎么能用javascript做。
我到目前为止尝试过的Ajax调用示例:
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);
}
});
我得到的回应是
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.