[英]How to call an external restful using $.ajax from within a SharePoint-hosted app (SharePoint Online)
如标题所述,我在从SharePoint内部调用外部Restful服务时遇到了麻烦。
'use strict';
var context = SP.ClientContext.get_current();
var user = context.get_web().get_currentUser();
// This code runs when the DOM is ready and creates a context object which is needed to use the SharePoint object model
$(document).ready(function () {
getUserName();
$.ajax({
dataType: "jsonp",
url: ' http://ip.jsontest.com/',
success: function (a, b, c) {
alert(a);
},
error: function (a, b, c) {
}
});
});
...
这将返回访问被拒绝。 我一直在兜圈子,试图弄清楚如何从浏览器发出外部呼叫。
如果有更好的方法使用客户端对象模型来执行此调用,则不需要从jQuery内部进行调用,那么我愿意接受任何建议。
这是因为您要从https(在线共享点)调用http Web服务。 将您的网络服务转换为https。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.