undefined getting returned from list

Nov 10, 2014 at 3:57 PM
I have a sharepoint list that contains replies to comments. When I pass in the ID to the list, I'm getting back the replies, plus [undefined], so my results are returned as

undefined reply1 reply2 reply2 for a comment

here is my code:
function QuestionReplies(qID)
{
    var reply= {};

        $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "QuestionReplies",
        CAMLViewFields: "<ViewFields>" + 
                                   "<FieldRef Name='Title' />" +
                                     "<FieldRef Name='Editor' />" +
                                   "</ViewFields>",
        CAMLQuery: "<Query><Where><Eq><FieldRef Name='Topic'/><Value Type='Number'>" + qID+ "</Value></Eq></Where><OrderBy><FieldRef Name='Modified' Ascending='False' /></OrderBy></Query>",
        completefunc: function (xData, Status) {
          $(xData.responseXML).SPFilterNode("z:row").each(function () {
               reply.comments += $(this).attr("ows_Title");                 
         });
        }
  });

return reply;
} 
and this does not return [undefined], but only returns me one reply back.
function QuestionReplies(qID)
{
    var reply= {};

        $().SPServices({
        operation: "GetListItems",
        async: false,
        listName: "QuestionReplies",
        CAMLViewFields: "<ViewFields>" + 
                                   "<FieldRef Name='Title' />" +
                                     "<FieldRef Name='Editor' />" +
                                   "</ViewFields>",
        CAMLQuery: "<Query><Where><Eq><FieldRef Name='Topic'/><Value Type='Number'>" + qID+ "</Value></Eq></Where><OrderBy><FieldRef Name='Modified' Ascending='False' /></OrderBy></Query>",
        completefunc: function (xData, Status) {
          $(xData.responseXML).SPFilterNode("z:row").each(function () {
               reply.comments = $(this).attr("ows_Title");              
         });
        }
  });
return reply;
} 
how can I get all replies to a question and not get the [undefined] as I'm getting back?
Coordinator
Nov 10, 2014 at 7:47 PM
I think the first item (assuming you mean that the first item's Title is undefined) is the folder which contains the Discussion item (you haven't said what type of list it is). Should you be excluding the folders?

M.
Nov 11, 2014 at 12:26 PM
its just pulling from a list named [QuestionReplies],
Coordinator
Nov 11, 2014 at 1:33 PM
Right, but I don't know anything about the contents of the list. Is there, in fact, a folder or some item in that list with no Title?

M.