My code is as below, I want to call the below function from a different JS file and use the xdata further for looping in that file.
function GetSPListItemByQuery(ListName, Query, Viewfields) {
However, xData is a valid odject in this context but returns "Null" to the calling function. Please advice.
function GetSPListItemByQuery(ListName, Query, Viewfields) {
var URL = $().SPServices.SPGetCurrentSite() + "/TeamSite";
alert("URL" + URL);
$().SPServices({
operation: 'GetListItems',
webURL: URL,
async: false,
listName: ListName,
CAMLQuery: Query,
CAMLViewFields: Viewfields,
completefunc: function (xData, Status) {
alert("In GetSPListItemByQuery " + xData.responseXML);
return xData;
}
});
}However, xData is a valid odject in this context but returns "Null" to the calling function. Please advice.