SP2013和SPServices

时间:2016-06-02 12:32:14

标签: spservices canvasjs

我正在寻找一种方法,将使用SPServices生成的CanvasJS图表放入Webpart页面。 到目前为止我做了什么:

  • 创建的网页部分页面(SPDesigner> SitePages> Webpart页面)
  • 添加了表格。
  • 在表中添加了<div id="chartContainer2" style="height: 300px; width: 100%;"></div>

  • 和页面底部的链接脚本:

        <SharePoint:ScriptBlock runat="server">if(typeof(MSOLayout_MakeInvisibleIfEmpty) == "function") {MSOLayout_MakeInvisibleIfEmpty();}</SharePoint:ScriptBlock>
        </table>
        <link rel="stylesheet" href="../SiteAssets/Jquery/jquery-ui.min.css"/>
        <link rel="stylesheet" href="../SiteAssets/DataTables/css/jquery.dataTables.min.css"/>
        <link rel="stylesheet" href="../SiteAssets/SoG.css"/>
        <script type="text/javascript" src="../SiteAssets/Jquery/external/jquery/jquery.js"></script>
        <script type="text/javascript" src="../SiteAssets/jquery.SPServices-2014.02.min.js"></script>
        <script type="text/javascript" src="../SiteAssets/DataTables/js/jquery.dataTables.min.js"></script>
        <script type="text/jscript" src="../SiteAssets/Jquery/jquery-ui.min.js"></script>
        <script type="text/javascript" src="../SiteAssets/CanvasJs/canvasjs.min.js"></script>
        <script type="text/javascript" src="../SiteAssets/Scripts/managementDashboard.js"></script>
    

在控制台中出现以下错误:

XMLHttpRequest cannot load http://00.000.00.00:00000/sites/ZZZZZ/_vti_bin/Lists.asmx. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.jQuery.ajaxTransport.send @ jquery.js:8706jQuery.extend.ajax @ jquery.js:8136ao.fn.SPServices @ jquery.SPServices-2014.02.min.js:19(anonymous function) @ managementDashboard.js:39jQuery.Callbacks.fire @ jquery.js:3048jQuery.Callbacks.self.fireWith @ jquery.js:3160jQuery.extend.ready @ jquery.js:433completed @ jquery.js:104

当我将相同的脚本放入.aspx页面(SPDesigner&gt; SitePages&gt; Page&gt; ASPX页面)时,一切都很好。脚本是jQuery脚本,看起来像:

    $(document).ready(function(){(..Code..
               $().SPServices({
                        webUrl: "http://00.000.0.00:000/sites/ZZZZZ/",
                        operation: "GetListItems",
                        async: false,
                        listName: "RIA",
        )
        });

添加或删除webUrl没有任何区别。 我试图避免创建aspx页面并在webpart页面的页面查看器中显示它... 知道如何在Webpart页面上使用SPServices吗?

0 个答案:

没有答案