我在2个不同的域中有2个站点(基于sharepoint 2013),例如: https://site1.com和https://site2.com。
我正在尝试从site1向site2发出请求以获取列表项(列表位于site2上)。
我正在尝试使用SP跨域库:
var re = new SP.RequestExecutor("https://site2.com");
re.executeAsync({
url: "https://site2.com/_api/web/Lists(guid'<list_guid>')/items";
method: "GET",
xhrFields: { withCredentials: true },
headers: {
"Accept": "application/json; odata=verbose"
},
success: function(response){ console.log("success!"); },
error: function(e){ console.log("fail!"); }
})
但是我得到一个带有未定义值的对象:
{
allResponseHeaders: undefined
binaryStringResponseBody: undefined
body: ""
contentType: undefined
headers: null
responseAvailable: false
state: underfined
statusCode: undefined
statusText: undefined
}
我的查询不正确吗?