SPServices on a Team Site

Mar 6, 2013 at 4:55 PM
I'm trying to get SPServices working on a team site within a large corporation. I don't have designer access and I'm not allowed to modify Masterpages. oh, and I can't download any text editor so I'm stuck using notepad. :(

I'm simply trying to fire an alert displaying the title to verify I can use SPServices.

Here is my code:
<Script type="text/javascript" src="../Style%20Library/jquery-1.9.0.min.js"></script>
<Script type="text/javascript" src="../Style%20Library/jquery.SPServices-0.7.2.min.js"></script>

<script type="text/javascript">

$(document).ready(function() { 
    runTest();
});

function runTest(){
     $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Marketing Operations Calendar",
    webURL: "../",
    completefunc: function (xData, Status) { 
                     //alert(xData.responseText);
         $(xData.responseXML).SPFilterNode("z:row").each(function() { 
              var testTitle = $(this).attr("ows_Title");
              alert(testTitle);
          });   
    }
     });
}

</script>
The scripts are loading into the DOM and I can fire an alert by itself without the SPServices successfully. I can also get results when I alert the xData.responseText.

Any idea what the hang up is?
Coordinator
Mar 7, 2013 at 3:41 PM
Probably the webURL. You need to specify it as a realtive path, but the .. thing won't work. Instead, you should specify something like /sites/mysitename.

BTW, you can edit and run your script interactively in the IE Developer Tools or Firebug. Your constraints are going to make thing hard, but working interactively may help.

M.
Mar 7, 2013 at 3:53 PM
The relative pathing works as I'm getting response XML. Even when I hard code the complete URL I get the same result. I get response XML but can't do anything with it. It's almost like there is a setting that IT turned off to disallow writing back to the DOM.

I also thought about the SPFilterNode. Is there anything else that might work insead of "z:row"?

Is there any other special issue with using SPServices on a team site?

PS. this is a calendar list that I'm pinging.
Coordinator
Mar 7, 2013 at 4:21 PM
It's basically impossible to "disallow writing back to the DOM". The could disable JavaScript with a policy, but clearly that's not the case.

When you look at xData.responseText, do you see the Titel column there? If the Title isn't in the default view of the clander (which it certainly usually would be) then it won't be returned because you aren't providing any overrides to the defaults. The fact that it's a team site is irrelevant.

M.