Error Callback function in call to GetListItems

Apr 18, 2011 at 10:34 AM

Hi,

While doing a jquery ajax call, there is an error callback that can be specified. Is there such an error callback in SpServices operation also?

Actually, I am trying to do a GetListItem operation---

    var query = "<OrderBy><FieldRef Name='Number' Ascending='False' /></OrderBy>"; 
    query = query +"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>"+id+"</Value></Eq></Where>";
      $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "Review",
        CAMLQuery: query,
        CAMLViewFields: "<ViewFields><FieldRef Name='Number'/></ViewFields>",
        CAMLRowLimit: 0,
        completefunc: function(xData, Status) {
          alert("complete !!");
          alert("inside completeFunc");
        }
      });
      alert("after operation call");
    }

 

But the control doesn't come to completefunc, neither does it come to "after operation call" alertbox. I was wondering how to find - any error messages, for instance. Thanks!

Coordinator
Apr 18, 2011 at 2:23 PM
Edited Apr 18, 2011 at 2:25 PM

The contents of your CAMLQuery operation should be wrapped with "<Query></Query>", ie: <Query><Where><Eq>Comparison</Eq></Where></Query>

Edit: I also just noticed that you're passing an id variable into your query and checking it against the title field; that may be correct but I wanted to point it out in case you had meant to use id instead of title.

Apr 19, 2011 at 7:25 AM

Thanks for the reply, the Query tags were indeed stopping the query. Actually I renamed the Title field to id, so that should work ok..thanks again!