将数据从一个网站集中到同一Web应用程序共享点2016中的另一个网站集中

问题描述 投票:0回答:1

我正在内部使用SharePoint 2016。我有一个Web应用程序,其中有两个网站集。网站1和网站2。我想使用rest或java脚本或J查询在网站集2页面上显示网站集1列表中的数据。我的环境未配置应用程序,因此我无法使用应用程序,甚至服务器端代码。请提出其他替代方法。

谢谢。

sharepoint-2013
1个回答
0
投票

如果有人有类似要求,请在此处共享脚本。

<script>
    $(function () {
        getDataFromSite1();
        getDataFromSite2();
    })

    function getDataFromSite1() {
        var url = "http://sp:12001/_api/web/lists/GetByTitle('MyList')/items";
        $.ajax({
            async: false,
            url: url,
            method: "GET",
            headers: {
                "accept": "application/json;odata=verbose",
                "content-type": "application/json;odata=verbose"
            },
            success: function (data) {
                console.log(data)
            },
            error: function (data) {

            }
        });
    }

    function getDataFromSite2() {
        var url = "http://sp:12001/sites/team/_api/web/lists/GetByTitle('MyList')/items";
        $.ajax({
            async: false,
            url: url,
            method: "GET",
            headers: {
                "accept": "application/json;odata=verbose",
                "content-type": "application/json;odata=verbose"
            },
            success: function (data) {
                console.log(data)
            },
            error: function (data) {

            }
        });
    }
</script>
© www.soinside.com 2019 - 2024. All rights reserved.