title: Refresh jQuery datatable table
body: <p>Been plenty of questions about this but I never found one that worked for me. I have a plain and simple HTML table whos body is being filled with rows from an AJAX call.
  Then I want to update the table with DataTable plugin but it does not work.
  I have a HTML table that looks like this:</p>
  
  <pre><code>&lt;table id="myTable"&gt;
    &lt;thead&gt;
       &lt;tr&gt;
            &lt;th&gt;1&lt;/th&gt;
            &lt;th&gt;2&lt;/th&gt;
            &lt;th&gt;3&lt;/th&gt;
            &lt;th&gt;4&lt;/th&gt;
            &lt;th&gt;5&lt;/th&gt;
       &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>In my jQuery pageload</p>
  
  <pre><code>$(document).ready(function(){
          var oTable = $('#myTable').dataTable({
              "aoColumns": [
                { "bSortable": false },
                null, null, null, null
              ]
          });
  });
  </code></pre>
  
  <p>And finally my on dropdownlist change function</p>
  
  <pre><code>$("#dropdownlist").on("change", function () {
          $("tbody").empty();
              $.ajax({
                  type: "POST",
                  url: "@Url.Action("ActionHere", "Controller")",
                  dataType: "json",
                  success: function (data) {
                      $.each(data, function (key, item) {
                          $("tbody").append("&lt;tr&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;3&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;/tr&gt;");
                      });
                  }
              })
          var oTable = $('#myTable').dataTable(); // Nothing happens
          var oTable = $('#myTable').dataTable({ // Cannot initialize it again error
                  "aoColumns": [
                    { "bSortable": false },
                    null, null, null, null
                  ]
              });
          });
  </code></pre>
  
  <p>The append and so on has been modified to shorten it down, etc so do not focus too much on it.</p>
  
  <p>Basically the question is how to update the table, I can do my AJAX and add new data to the table fine, but the datatable plugin does not update with it.
  I've tried other things like </p>
  
  <blockquote>
    <p>.fnDraw(false);</p>
  </blockquote>
  
  <p>But it does nothing
  While I get an JSON error from </p>
  
  <blockquote>
    <p>fnReloadAjax()</p>
  </blockquote>
  
  <p>Any clues on just how to refresh the table?</p>