enter code here
I 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);
$().SPServices({
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");
alert(thisID);
});
}
});
}
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.