[英]SharePoint add-in [SharePoint hosted app in Office 365] Rest api call Cross Origin Resource Sharing error?
When i tired to get list title from developer site present in SharePoint online, i get CROS error. 当我厌倦了从SharePoint Online中存在的开发人员网站获取列表标题时,我得到了CROS错误。 I have provided full permission to list and web in AppManifest.xml;
我已经在AppManifest.xml中提供了完整的列表和网站访问权限;
It is a simple ajax call that consume Sharepoint api rest services 这是一个简单的ajax调用,使用了Sharepoint api rest服务
Code:- 码:-
function ajaxcall() {
var url1 = "https://xxxlll365.sharepoint.com/sites/devsite/_api/web/lists/getbytitle('xxx')/items?$select=Title";
$.ajax({
url: url1,
dataType: 'json', //tired xml,jsonp, crossdoman:true [no big change]
cros: true,
success: function (result) {
$("#div1").html(result);
}
});
Console Error XMLHttpRequest for https://xxxlll365.sharepoint.com/sites/devsite/_api/web/lists/getbytitle ('xxx')/items?$select=Title required Cross Origin Resource Sharing (CORS)."Error" https://xxxlll365.sharepoint.com/sites/devsite/_api/web/lists/getbytitle('xxx')/ items的控制台错误XMLHttpRequest?$ select =标题为必需的跨源资源共享(CORS)。“错误”
Tired with angularJS and got same error as above ! 厌倦了angularJS并得到与上面相同的错误!
Here are some detailed articles for your reference: 以下是一些详细的文章供您参考:
WebAPI and CORS enabled REST services 启用了WebAPI和CORS的REST服务
Cross Site Scripting with SharePoint 2013 REST calls 使用SharePoint 2013 REST调用进行跨站点脚本
Try include in the header these options: 尝试在标题中包含以下选项:
" Control-Allow-Origin "," https://xxxlll365.sharepoint.com ") “ Control-Allow-Origin ”,“ https://xxxlll365.sharepoint.com ”)
" Origin "," https://xxxlll365.sharepoint.com ") “ 来源 ”,“ https://xxxlll365.sharepoint.com ”)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.