jquery spservices getlistitems

user1652050 picture user1652050 · Mar 3, 2013 · Viewed 9k times · Source

im trying to get listitems from a sharepoint list using jquery spservices. but it doesnt return any listitems. here's the code, anyone knows what's wrong?

var _query = "<Query><Where><Eq><FieldRef Name='Title' /><Value Type='Text'>maandag</Value></Eq></Where></Query>";

$().SPServices({
    operation: 'GetListItems',
    async: false,
    listName: 'OpeningsTijden',
    CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='Time' /></ViewFields>",
    CAMLQuery: _query,
      completefunc: function (xData, Status) {
                    alert(xData.responseText);
                    $(xData.responseXML).SPFilterNode("z:row").each(function() { 

         alert('yessir');

                        });                
                    }

        });

thanks in advance

Answer

Scott McGrath picture Scott McGrath · Feb 8, 2016

It's always a good idea to use the debug feature to ensure your request is working:

if (Status == "success") {
  alert(xData.responseXML);
}else {
  var out = $().SPServices.SPDebugXMLHttpResult({
  node: xData.responseXML,
  outputId: myRequests
});

$('#myRequests').html(out);
}