-1

i'm trying to retrieve data from Sharepoint using SPServices. I created a list called "values" with two field: "Title" (text field) and "values" (numeric field).

I created a js file linked to a Content Editor Web Part and used this script:

    <script type="text/javascript" src="/jquery-2.1.4.js"></script>
<script type="text/javascript" src="/jquery.SPServices-2014.02.js"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function() {
  $().SPServices({
    operation: "GetListItems",
    async: false,
    listName: "values",
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /></ViewFields>",
    completefunc: function (xData, Status) {
      $(xData.responseXML).SPFilterNode("z:row").each(function() {
        var liHtml = "<li>" + $(this).attr("ows_Title") + "</li>";
        $("#tasksUL").append(liHtml);
      });
    }
  });
});
</script>
<ul id="tasksUL"/>

When I charge the page I have no result. I tried to put an alert of XData.responseXML and it return "Undefined".

How can I resolve it?

  • I would check the case of your list name, try Values. Also emitting XData would be wrong, you'd want xData.responseXML, case sensitivity in JS is important. – Eric Alexander Jul 14 '15 at 16:51
  • Thank you, I checked it. The name of the list is lowercase (values) – user2277798 Jul 14 '15 at 17:06
  • Are your references to jquery and spservices correct? Do your browser tools indicate any errors? – Eric Alexander Jul 14 '15 at 18:48
  • Yes, references are correct. My browser doesn't indicate anything. Blank page! – user2277798 Jul 15 '15 at 7:25
  • Are there any errors in the console? In Chrome on windows use F12 to show these developer tools. – Jan Jouke Tjalsma Jul 16 '15 at 11:56
0

Check your jQuery and SPServices version libraries. I received the same error when using new versions of both libraries. I didn't receive the error using the older versions.

Error Libraries: jquery-1.12.3.js jquery.SPServices-2014.02.min.js

Non-Error Libraries: jquery-1.8.3.js jquery.SPServices-0.7.1a.min.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.