enter code hereI am using an example I found on codeplex of SPServices with CamlQuery to try to get list item values with where clause on the ID. For whatever reason this doesn't seem to work for me; please help!

function getToolInfo(lastID) {

    var CamlQuery = "<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>" + lastID + "</Value></Eq></Where></Query>";
    var CamlViewFields = "<ViewFields><FieldRef Name='ID' /><FieldRef Name='Title' /></ViewFields>";

  // this let me know that the function is getting called and passed the correct parameter value
  alert('function called and passed last ID of : ' + lastID);
    operation: "GetListItems",
    async: false,
    listName: "FirstList",
    CAMLViewFields: CamlViewFields,
    CAMLQuery: CamlQuery,
      completefunc: function (xData, Status) {
        $(xData.responseXML).find("[nodeName='z:row']").each(function() {

        // just load a new variable with the returned value        
        var thisID = $(this).attr("ows_ID");


did I miss something obvious here? basically all the alerts are working except for the last.

Additionally if I remove this line:

$(xData.responseXML).find("[nodeName='z:row']").each(function() {

then i can add alert that works. I have double, triple, etc checked the list item with that ID and it is there.

2 Answers 2


If you are using jQuery 1.7+, the syntax you are using to find the z:row elements no longer works. Use the SPFilterNode function instead.

  • Well, it's in the documentation....in big bold red caption at that. Appreciate it Marc, I missed that. :)
    – Justin
    Jun 22, 2012 at 10:40
  • 2
    Maybe I should switch to marquee and flashing. :-) Jun 22, 2012 at 14:39
$(xData.responseXML).find("z\\:row").each(function () {

Change your line as I mentioned above. I have tested and it's working also in later versions of jQuery

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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