title: Data table initialize after table body replace (ajax)
body: <p>I have a datatable it have a search box (date range filter) once i click the search button table body replace according to the filter(ajax).</p>
  <p>my problem is i cant initialize table after ajax success.</p>
  <p><strong>HTML</strong></p>
  <pre><code>&lt;table data-page-length=&quot;20&quot; id=&quot;occupancy&quot; class=&quot;ui small celled table segment display&quot; cellspacing=&quot;0&quot;
         width=&quot;100%&quot;&gt;
      &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;Date&lt;/th&gt;
          &lt;th&gt;Arrivals&lt;/th&gt;
          &lt;th&gt;Departures&lt;/th&gt;
          &lt;th&gt;Occupied&lt;/th&gt;
          &lt;th&gt;Available&lt;/th&gt;
          &lt;th&gt;Occupancy&lt;/th&gt;
      &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody id=&quot;occupancyBody&quot;&gt;
  
      &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  <p><strong>Ajax</strong></p>
  <pre><code>        type: 'POST',
          url: &quot;../system/user/modules/&quot; + MODULE_NAME + &quot;/controller.php&quot;,
          data: &quot;action=filterOc&amp;&quot; + url_data,
          success: function (resultData) {
              $('#occupancyBody').html(resultData);
              $('#occupancy').dataTable();
          }
      });
  </code></pre>
  <p><a href="https://i.stack.imgur.com/kvu31.png" rel="nofollow noreferrer">sample screenshot</a></p>