需要關於sharepoint 2013 Rest API和Ajax Call的幫助。需要關於Sharepoint 2013的幫助需要Ajax調用的Rest API
我在嘗試從發佈網站讀取列表項目到團隊網站。這兩個網站都在不同的網站集合中。
下面的代碼在Internet Explorer中工作正常,而不是在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");}
});
});
該響應具有Http狀態碼401
。從$.ajax
請求的錯誤是
無法加載資源:服務器與401狀態(非授權)
錯誤2回答:
XML的HttpRequest無法加載否「 Access-control-Allow-Origin'標題出現在請求的資源上。 Oringin'url'因此不被允許訪問。
我沒有訪問服務器的權限。我只需要使用SharePoint 2013頁面上的腳本編輯器進行嘗試。
Chrome/Firefox返回什麼錯誤,以及您使用的是哪個版本的IE? –
@Daniel - 錯誤1:加載資源失敗:服務器響應的狀態爲401(未授權) 錯誤2:XML HTtpRequest Canot加載 沒有'Access-control-Allow-Origin'標頭存在請求的資源。 Oringin'網址'因此不允許訪問。結果有Http狀態代碼401 \t 不幸的是我沒有訪問服務器。我必須用OOB Controls解決這個問題。我在Sharepoint 2013中使用腳本編輯器運行此!任何想法 ? –