tags:

views:

39

answers:

1

I am trying to use the jQuery each function (line 5) to display the results of an AJAX call. when I write resultObj.value on line 6 how come I am not getting any data?

Am I making a syntax error (I am pretty sure that I must be)?

success : function(resultObj) {
count = count+1;
$(".objHolder").filter("#"+id).append("<table border='1' cellspacing='4' cellpadding='4' class='preTable' id='"+id+"' level='"+count+"'><tr><td class='preItem' id='"+id+"' level='"+count+"'><img src='images/right.jpg' width='16' height='10' /></td><td class='preList'>&nbsp;</td><td class='preHolder' level='"+count+"'>&nbsp;</td></tr></table>");
                isClicked[level]="yes";
                $.each(resultObj, function(index, value){
                    $(".preHolder").filter("#"+id).append(resultObj.value);
                    });
                }
            });
+3  A: 

Try

$(".preHolder").filter("#"+id).append(value);

You are iterating over an array and you can get the index and value directly.

rahul