title: How to auto load the datatable after inserting the data using Ajax
body: <p>Hi developers <strong>I have here my modules that i need to get the customers data in the first row after user registered.</strong></p>
  
  <p><strong>I have question is there way to load every seconds the datatable? do I need to set interval for this to load every second?</strong></p>
  
  <p>I have here my function listing all the customers data</p>
  
  <pre><code>    $(document).ready(function(){
    $.ajax({
      url:'/logic_get_customer_data',
      type: 'GET',
      dataType: 'json',
      success:function(response) {
  
        var details = response.data;
  
        $.each(details, function (index, el) {
  
            var stringify = jQuery.parseJSON(JSON.stringify(el));
  
            var customer_name_each = stringify['customer_name'];
            var customer_address_each = stringify['customer_address'];
            var customer_email_each = stringify['customer_email'];
            var customer_number_each = stringify['customer_number'];
            var store_location_each = stringify['customer_location'];
            var customer_order_note_each = stringify['customer_order_note'];
            var customer_registered_each = stringify['customer_registered'];
            var customer_id_each = stringify['customer_id'];
            var action_each = '&lt;button id="show_cart_button" class="btn btn-primary" type="button" value='+customer_id_each+' data-toggle="modal" data-target="#add_cart" &gt;&lt;i class="fas fa-cart-arrow-down"&gt;&lt;/i&gt;&lt;/button&gt;';
  
            var t = $( "#tables" ).DataTable();
            t.row.add([customer_name_each,
              customer_address_each,
              customer_email_each,
              customer_number_each,
              store_location_each,
              customer_order_note_each,
              customer_registered_each,
              action_each]).draw();
  
          })
      }
  
    });
  });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/GYJwF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GYJwF.png" alt="Output"></a></p>