0

For some reason, I cannot access the data from appended rows. The count shows 0. The rows are appended but I just can't access the dynamic ones.

fetchRecords();
var count = $('#tabledata').rows;
console.log(count);

function fetchRecords() {
  $.ajax({
    url: '/data',
    type: 'get',
    dataType: 'json',
    success: function(response) {
      var len = 0;
      if (response['data'] != null) {
        len = response['data'].length;
      }
      if (len > 0) {
        for (var i = 0; i < len; i++) {

          var amount = response['data'][i].amount;
          var style = response['data'][i].style;
          var row = '<tr>' +
            '<td class="symbol"><label class="label bg-dark">' + amount + '</label></td>' +
            '<td> ' + style + ' </td>' +
            '</tr>';
          $("#tabledata").append(row);
        }
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
LEGENDA
  • 3
  • 2

0 Answers0