I could not find a good example of how to do this so here is my solution. Hopefully it will be helpful to someone. Here is a quick example of how to retreive data from a list with SP services and then filter the results before displaying them. In my example I needed to get the data from a list but display part of it in two different places on the page
// normal sp spervices call to the list
function getFooterLnks() {
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Links",
completefunc: function(xData, Status) {
// this function runs on the data we get back
getDataFooter(xData, Status,colArray);
}
});
}
function getDataFooter(xData, Status) {
// putting the data into a Json object
var myJson = $(xData.responseXML).SPFilterNode("z:row").SPXmlToJson({
mapping: {
ows_Title: {mappedName: "Title", objectType: "Text"},
ows_Column: {mappedName: "Column", objectType: "Text"},
ows_Url: {mappedName: "Url", objectType: "Text"},
ows_Cat: {mappedName: "Category", objectType: "MultiChoice"}
},
includeAllAttrs: false
});
// now we need to filter the Json object the col variable holds the term I want to filter by
var col = "Category 1";
// check if the value appears in the Json
myJsonResults = $(myJson).filter(function(){
return this.Category[0].indexOf(col) !== -1;
});
// put each of the results in an object with html formatting
var items = [];
$.each(myJsonRes, function() {
items.push("
<ul>
<li><a title="" href="" + this[">" + this['Title'] + "</a></li>
</ul>
");
});
");
});
$('#linksWrapper').append(items);
}