This project has moved. For the latest updates, please go here.

GetListItems not working

Jan 16, 2014 at 4:34 PM
Hi Marc,

Thank you so much for SPServices. It's a treasure trove. Just what I was looking for...

I have one problem...I can't get GetListItems to work. I'm using SP 2007 with your GetListItem generator. I've checked the references to jQuery and your file many times and they work fine.

This is the code, which I'm putting in a Content Editor Web Part.
<script type="text/javascript"> $(document).ready(function() { var htmlTable = '<table>'; $().SPServices({ operation: "GetListItems", async: false, listName: "Domains", CAMLViewFields: "<ViewFields>" + "<FieldRef Name='Title' ></FieldRef>" + "<FieldRef Name='Domain_x0020_Description' ></FieldRef>" + "</ViewFields>", completefunc: function (xData, Status) { $(xData.responseXML).SPFilterNode('z:row').each(function() { htmlTable += "<tr>" + "<td>" + $(this).attr("ows_Title") + "</td>" + "<td>" + $(this).attr("ows_Domain_x0020_Description") + "</td>" + "</tr>"; }) htmlTable += "</table>"; } }); }); </script>
Jan 16, 2014 at 4:42 PM
Edited Jan 16, 2014 at 4:43 PM
It looks like you're building up the htmlTable variable, but you're not doing anything with it. When you say that you "can't get GetListItems to work", what's the actual problem?

Marked as answer by myahia on 1/17/2014 at 7:15 AM
Jan 17, 2014 at 1:00 PM
Ahhh... my fault. I added the variable in an html method to a div and it worked like a charm!
Jan 17, 2014 at 1:03 PM