showing results for - "html jqueryajax"
Myrtle
24 Oct 2020
1	  function successFunction(data) {
2        var allRows = data.split(/\r?\n|\r/);
3        var table = '<table>';
4        for (var singleRow = 0; singleRow < allRows.length; singleRow++) {
5          if (singleRow === 0) {
6            table += '<thead>';
7            table += '<tr>';
8          } else {
9            table += '<tr>';
10          }
11          var rowCells = allRows[singleRow].split(',');
12          for (var rowCell = 0; rowCell < rowCells.length; rowCell++) {
13            if (singleRow === 0) {
14              table += '<th>';
15              table += rowCells[rowCell];
16              table += '</th>';
17            } else {
18              table += '<td>';
19              table += rowCells[rowCell];
20              table += '</td>';
21            }
22          }
23          if (singleRow === 0) {
24            table += '</tr>';
25            table += '</thead>';
26            table += '<tbody>';
27          } else {
28            table += '</tr>';
29          }
30        } 
31        table += '</tbody>';
32        table += '</table>';
33        $('body').append(table);
34      }
35
similar questions
queries leading to this page
html jqueryajax