title: Datatables error after ajax call, ASP.Net
body: <p>I'm using ajax to call a partial view with a table inside a div called "div-GVPrevision". I'm using datatables, but I'm getting an error after the ajax call, and it says:</p>
  
  <p>"DataTables warning: table id=GVPrevision - Cannot reinitialise DataTable. For more information about this error, please see <a href="http://datatables.net/tn/3" rel="nofollow noreferrer">http://datatables.net/tn/3</a>"</p>
  
  <p>This is the ajax code:</p>
  
  <pre><code>&lt;script&gt;
      function GVPrevision() {
          $('#GVPrevision').DataTable({
              "aaSorting": [],
              aLengthMenu: [
                  [4, -1],
                  [4, "Todo"]
              ],
              responsive: false
          });
      }
      $(document).ready(function () {
          GVPrevision();
          $('.btnagregar').click(function (event) {
              event.preventDefault();
              var data = {
                  "codmov": $("#codmovf").val(),
                  "fechainicio": $("#fechainiciof").val(),
                  "fechatermino": $("#fechaterminof").val(),
                  "rutentidad": $("#rutentidadf").val(),
                  "motivo": $("#motivof").val()
              };
              $.ajax({
                  url: "/Ficha/AgregarfooterPrevision",
                  type: "POST",
                  data: JSON.stringify(data),
                  dataType: "json",
                  contentType: "application/json",
                  success: function (response) {
                      if (response.Success) {
                          $("#div-GVPrevision").load('@Url.Content("~/Ficha/GVPrevision")');
                          GVPrevision();
                      }
                      else
                          window.location.href = "@Url.Action("Prevision", "Ficha")";
                  },
                  error: function () {
                      console.log('Login Fail!!!');
                  }
              });
          });
      });
  &lt;/script&gt;
  </code></pre>