Reputation: 49
My code is
var obj = $.parseJSON(json.responseText);
$.each(obj.collection.response, function (i) {
$.each(this.PRESENT_STUDENT, function (i, j) {
$.each(j , function (i, j){
$('#result-table tr:last').after("<tr><td>"+ j +"</td></tr>");
})
})
})
but when i run this i get error "Uncaught TypeError: Cannot read property 'length' of undefined"
Upvotes: 0
Views: 4867
Reputation: 8080
Well, you example works: created this fiddle:
$.each(obj.collection.response, function (i, val) {
// check needed because of 'status' property (see http://jsfiddle.net/6JWE7/4/)
if (this.PRESENT_STUDENT) {
$.each(this.PRESENT_STUDENT, function (i, j) {
$.each(j , function (i, j){
$('#result-table tr:last').after("<tr><td>"+ j +"</td></tr>");
});
});
}
});
Upvotes: 1