I am new to SPServices and trying start with example GetListItems. Below is my code
$(document).ready(function() {
GetTasks();
});
function GetTasks()
{
var method = "GetListItems";
var list = "Tasks";
var fieldsToRead ="<ViewFields><FieldRef Name='Title'/></ViewFields>";
var query ="<Query><Where><Eq><FieldRef Name='ID'/><Value Type='Counter'>1</Value></Eq></Where></Query>";
$().SPServices({
operation: method,
async: false,
listName: list,
CAMLViewFields: fieldsToRead,
completefunc: function (xData, Status) {
debugger;
$(xData.responseXML).find("z\\:row").each(function() {
alert("hello");
var name = ($(this).attr("ows_Title"));
});
}
});
}
The debugger in the completefunc is hit but when I check the status of function(xData, status)
the status returns "error".And after this alert("hello")
does not hit.
What is that I am doing wrong in this ?