view raw
eng_mazzy eng_mazzy - 9 months ago 33
JSON Question

Print json data in a table

I have wrote the following function but I'm pretty sure there is an error. This is the error when I try to execute this chunck of code

TypeError: 'undefined' is not a function (evaluating 'callback.apply( obj[ i ], args )')

Jquery function receive data json list correctlu


.each(data, function(){

this is the DOM

<div id='result_times'>




Can you suggest me where I wrong?


You are running each() on each table, so jQuery is expecting a function as the first argument to the each, not data. Also you are calling text() on the wrong element.

Run the each on the data by using $.each.

Working example:



var table = $('#result_times table');

$.each(data, function(){