How to append json array data to html table tbody

后端 未结 3 1064
迷失自我
迷失自我 2021-01-24 03:21

I am very new into jQuery and JSON. I need to parse a JSON of the following format so as to populate a html table tbody:

{\"response\":[[\"name0\",\"id0\",\"amt0         


        
3条回答
  •  逝去的感伤
    2021-01-24 03:31

    Not tested but it can be something like:

    var jsondata=$.parseJSON('{"response":[["name0","id0","amt0"],["name1","id1","amt1"]]}');
    
    $.each(jsondata.response, function(i, d) {
       var row='';
       $.each(d, function(j, e) {
          row+=''+e+'';
       });
       row+='';
       $('#table tbody').append(row);
    });
    

提交回复
热议问题