Javascript 使用ECMA从SharePoint欢迎页面查询两个不同列表时出现问题

Javascript 使用ECMA从SharePoint欢迎页面查询两个不同列表时出现问题,javascript,sharepoint,Javascript,Sharepoint,我的方法在这里行不通。我在SharePoint 2010文档集的欢迎页面上,并已将脚本放置在内容编辑器Web部件CEWP中。我使用以下代码获得了一块jquery/javascript。我可以从两个不同的代码块中获得一组或另一组值,但不能同时获得这两个值。所以,我在两个查询中复制一些代码行似乎会导致冲突,但我不确定我可以更改什么来使两个集合都唯一,或者两者之间发生冲突。非常感谢您的指导。我现在只是在兜圈子。谢谢-戴夫 我使用的两个块看起来像这样,但在listName上不同。也许页面只能支持其中一个

我的方法在这里行不通。我在SharePoint 2010文档集的欢迎页面上,并已将脚本放置在内容编辑器Web部件CEWP中。我使用以下代码获得了一块jquery/javascript。我可以从两个不同的代码块中获得一组或另一组值,但不能同时获得这两个值。所以,我在两个查询中复制一些代码行似乎会导致冲突,但我不确定我可以更改什么来使两个集合都唯一,或者两者之间发生冲突。非常感谢您的指导。我现在只是在兜圈子。谢谢-戴夫

我使用的两个块看起来像这样,但在listName上不同。也许页面只能支持其中一个

         $(document).ready(function () {
        $().SPServices({
            operation: "GetListItems",
            async: false,
            CAMLRowLimit: 2000,                
            listName: "Personnel Management",
            completefunc: fnCallBack
        });
    });


    function fnCallBack(xData, Status) {
        var index = 0;
        $documentListtable = $("#documentListtable");
        //Navigate through the XML
        $(xData.responseXML).find("z\\:row, row").each(function () {


    //Get the values to a local variable
            var _url = $(this).attr("ows_FileRef").split(";#")[1];
            var _name = $(this).attr("ows_LinkFilename");
       ;
            var _author = $(this).attr("ows_Editor").split(";#")[1];
            var modifiedOn = $(this).attr("ows_Modified");
            var _TrainingStatus = $(this).attr("ows_Training_x0020_Certificates");




            //Create clone of the table row
            var $row = $("#templates").find(".row-template").clone();

            //Add values to the column based on the css class

            $row.find(".DocumentName").html(_pdfLink);
            $row.find(".Author").html(_author);
            $row.find(".LastModifiedOn").html(modifiedOn);
            $row.find(".TrainingStatus").html(_TrainingStatus);


            //Change the style for even rows
            if (index % 2 == 0) {
                $row.addClass("jtable-row-even")
            }


     if (_TrainingStatus.indexOf("1001") !=-1)
      {
       index = index + 1;
            //add the row to table
            $documentListtable.append($row);

           }

                    - 

您可以尝试在一个$(document.ready)块中添加两个SPSServices调用,而不是在两个$(document.ready)块中添加。一个页面中可以有多个$(document).ready,但您的问题听起来好像在页面加载时只触发了一个SPSService调用