Exact same GetListItem code works when in one library documents set welcome page but not another library set document page on the same site

Feb 24, 2014 at 8:44 PM
Edited Feb 24, 2014 at 8:45 PM
Exact same GetListItem code works when in one library documents set welcome page but not another library set document page on the same site.  I am trying to use SPServicews to view data in a document page welcome page that is pulled from another libraries metadata on the same site.  This works fine.  But if I use the CEWP to pull this same data from the library it is coming fun and put the CEWP on a welcome page of one of the document sets on this library the data does not render.   So in brief the same code will not pull data when loaded within a welcome page from that library but it will pull the data when on a CEWP in another libraries Document Set We;lcome Page.  There is no other custom code on the library it is not pulling from i.e. only a single use of the SPServices the code of which is as follows.  Seems I've created some sort of "Gotcha" for myself and any help would be appreciated.  thanks -dave

<html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882">
<head>
<script src="https://XXXX/JQUERY/jquery-1.8.3.min.js"></script>
<script src="/XXXX/jquery.SPServices-0.7.2.min.js" type="text/javascript"></script>
    <style>
        .row-template
        {
            background: rgb(248, 248, 248);
            padding: 2px;
            height: 30px;
        }
        
        .row-column
        {
            width: 150px;
            align: left;
            font-weight: bold;
        }
        
        .jtable-row-even
        {
            background: rgb(240, 240, 240);
        }
    </style>

    <script>




  $(document).ready(function () 
{

var pnx=$("b:contains('Project Number')").parent().next().next().text(); //MUST BE INSIDE LOOP TO USE WITH INDEX OF!!!
//alert("not");
//alert(pnx);

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

            });  //SPSERVICES
        
     }); //READY

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

 var _ProjectNumbers1 = $(this).attr("ows_Project_x0020_Numbers");



                //Get the values to a local variable
                var _url = $(this).attr("ows_FileRef").split(";#")[1];
                var _name = $(this).attr("ows_LinkFilename");
                var _pdfLink = $("<a  href='/" + _url + "'>" + _name + "</a>");
                var _author = $(this).attr("ows_Editor").split(";#")[1];
        var _SalarySource = $(this).attr("ows_Salary_x0020_Source");
        var _TrainingStatus = $(this).attr("ows_Training_x0020_Certificates");
            var _ProjectNumbers = $(this).attr("ows_Project_x0020_Numbers");
                //var modifiedOn = $(this).attr("ows_Modified");
               
       

              //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(".Personnel").html(_pdfLink);
        $row.find(".SalarySource").html(_SalarySource);
                $row.find(".TrainingStatus").html(_TrainingStatus);
        $row.find(".ProjectNumbers").html(_ProjectNumbers);
                //$row.find(".LastUpdated").html(modifiedOn);
               
                

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

   var pnx1=$("b:contains('Project Number')").parent().next().next().text();  //THIS var must be inside loop!!!
 
 if (_ProjectNumbers){
 var nx=_ProjectNumbers.indexOf(pnx1); 
  

if (nx != -1 && pnx1 >1)  /// && _ProjectNumbers
{
//alert("inside thing")
           index = index + 1;
                //add the row to table
                $documentListtable.append($row);

}
}
            });  //EACH FUNcTION
       
            } //FUNCTION CALL BACK



    </script>


</head>
<body>




    
<table table id="documentListtable">
        <tr class="row-template">
            <td class="row-column">
               Personnel
            </td>
            <td class="row-column">
                Salary Source
            </td>
            <td class="row-column">
                Training Status
            </td>
            <td class="row-column">
                Project Numbers
            </td>
            <!--<td class="row-column">
                Last Updated On
            </td>-->
           
        </tr>
    </table>
    <div id="templates" style="display: none">
        <table>
            <tr class="row-template">
                <td class="Personnel" alighn="center" style="width: 100px;">
                </td>
                <td class="SalarySource" style="width: 100px;">
                </td>
                <td class="TrainingStatus" style="width: 100px;">
                </td>
                <td class="ProjectNumbers" style="width: 100px;">
                </td>
                <!--<td class="LastUpdated" style="width: 100px;">
                </td> -->
            </tr>
        </table>
    </div>



<br><a href="https://XXXXX/Item/newifs.aspx?List=ETC.  XXXX &Web=b4c241ca%2D3fea%2D4f09%2Da75a%2D153fc867170b" target="_blank">Click Here to Declare and Modify Project Staffing!</a>
</body>
</html>