GetListItems

Feb 10, 2013 at 3:59 PM
Edited Feb 10, 2013 at 4:01 PM
Hello,

I'm trying to use the example get list items script, with no luck at all. Here's my code:
<script language="javascript" type="text/javascript">

$(document).ready(function() {

  $().SPServices({
    operation: "GetListItems",
    async: false,
    webURL: "https://DOMAIN/SITE",
    listName: "Announcements",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
    completefunc: function (xData, Status) {

    alert(xData.responseXML.xml);
      $(xData.responseXML).find("[nodeName=z:row]").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
        $("#tasksUL").append(liHtml);
      });
    }
  });
});
</script>
<ul id="tasksUL"/>
The list is called 'Announcements' and the webURL is actually the root site in SharePoint. I am calling this from a different web application - a custom mobile site - where I want to show the data from the Announcements list in the non-mobile site.

Safari 6, which I'm using to test gives me the error 'Failed to load resource: the server responded with a status of 440 (login Timeout)', but the completefunc does fire with the xData.responseXML.xml containing nothing when the alert pops up. I'm not exactly sure what I'm doing wrong? Other browsers silently fail - no error except showing xData.responseXML.xml is 'undefined'.

If it makes any difference, traffic is being sent through MS Forefront Threat Management Gateway.
Coordinator
Feb 11, 2013 at 11:30 AM
Odds are that you're running into an authentication issue. If you look at the network traffic with Fiddler or Firebug, you should get some clues about where the issue is.

The completefunc is going to fire whether or not there is a success.

Note that the .find("[nodeName=z:row]") syntax will not work with any version of jQuery after 1.7. Use SPFilterNode instead.

M.