Issue with MasterPage Configuration? GetListItems won't work.

Feb 10, 2012 at 7:47 PM
Edited Feb 10, 2012 at 7:48 PM
Hi All,
Pardon the ignorance.  Edited the site MasterPage to include SPServices there.
I have a script running as a referenced .txt from a Content Editor Web Part in
SharePoint 2010 that should return the list items from Tasks list and append them to
an HTML <ul>. The jQuery works fine, and the SPServices appears to execute, but I
receive an empty document object ('[object]') as my value for 
the xData.responseXML when the callback is done.  
David
<html>
<ul id="tasksUL"><li>HELLO.</li></ul>
</html>

<script language="javascript" type="text/javascript">

$("#MSO_ContentTable").css("background-color","cyan");

$(document).ready(function(){

  alert('got here');

   var query = "<Query><OrderBy><FieldRef Name='ID'/></OrderBy></Query>";

  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "Tasks",
    CAMLQuery: query,
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
    completefunc: function (xData, Status) {
                alert(xData.responseXML);

      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
        $("#tasksUL").append(liHtml);
      });
    }
  });


});

  var liHtml = '<li>SOME STUFF</li>';
  $("#tasksUL").append(liHtml);

</script>
Coordinator
Feb 10, 2012 at 7:56 PM

Dave:

Try looking at xData.responseXML.xml or xData.responseText. With xData.responseXML, you're looking at the XML object.

M.

Feb 10, 2012 at 8:13 PM
Edited Feb 10, 2012 at 8:42 PM

Marc:

Thanks for quick response.  I changed it to xData.responseXML.xml and am now seeing the data.  Next step is to get the most current version of your library (am using 0.6.2 at present...) :o)

DTPD