The array initialization looks different than what I use. I am not a javascript expert, and that may work, but this is what I had working in some of my code:
function lastupdate(R) { var a = new Array(); // stores mod date values from associated tables var d = new Date(); // holder for ea date var myQuery = "<Query><Where><Eq><FieldRef Name='rfc_id' /><Value Type='Number'>"+R+"</Value></Eq></Where></Query>"; // get the schedule items $().SPServices({ operation: "GetListItems", async: false, listName: "tbl_A", CAMLViewFields: "<ViewFields><FieldRef Name='Modified' /></ViewFields>", CAMLQuery: myQuery, completefunc: function (xData, Status) { $(xData.responseXML).find("[nodeName='z:row']").each(function() { var d = $(this).attr("ows_Modified"); a.push(d); }); } }); // out of SPServices a.sort(); return a[a.length-1]; // last item in array of dates should be the latest. }
Note, using pre-0.7.1 version of SPServices (.find not .SPfilternode, but will work with 0.7.1 and .SPfilternode).
This is a subset of the code... I use six GetListItems calls to collect the @Modified dates of all child records of a parent record, so I can display the overall last modified date.