我在尝试一些简单的操作 - 从SharePoint 2013列表中检索列表信息。但是,当处理jQuery Ajax时,我正在拒绝访问。我试着设置头对象和beforeSend函数,但没有成功。这里是我的jQuery.Ajax:SharePoint 2013 API jQuery.Ajax拒绝访问
$.ajax({
headers: { // also tried with Authentication
"Authorization": someBasicCryptedCred,
"Accept": "application/json; odata=verbose"
},
url: "http://spSiteCollection/_api/web/lists/getbytitle('MyList')/items",
type: "GET",
success: SuccessProcess,
error: ErrorProcess
});
我的应用程序是一个简单的MVC移动应用程序
我下面这些文件(从MSDN一些其他的一起,但不能发布超过2个链接):
http://msdn.microsoft.com/en-us/library/jj870858.aspx http://msdn.microsoft.com/en-us/library/jj163228.aspx
你在不同的领域有这个?闻起来像一个交叉来源问题 –
是同一台服务器上的共享点应用程序?也许你遇到[同源策略](http://en.wikipedia.org/wiki/Same-Origin-Policy)。 –
是的,我的应用程序和SharePoint服务器都位于同一台服务器上。 另外,我添加了$ .support.cors = true;在加载页面,否则我得到没有运输。 –