Resfresh Datatable после функции ajax - PullRequest
0 голосов
/ 22 октября 2018

my Datatable не перерисовывает событие. Я вызываю функцию .draw(); ...

Мой HTML:

{Contactos}
                <tr>
                    <td>{IdContacto}</td>
                    <td >{NomeContacto}</td>
                    <td>{NumeroContacto}</td>
                    <td class="IdContacto" data-id="{IdContacto}"><a style="color: white; margin-left: 20px;" data-toggle="modal" data-target="#EditNumber" type="button" class="btn btn-success"> <i style="color: white; padding-right: 6px;" class="fa fa-edit"></i>Editar</a><a style="color: white; margin-left: 20px;" data-toggle="modal" data-target="#DeleteNumber" type="button" class="btn btn-danger"> <i style="color: white; padding-right: 6px;" class="fa fa-trash"></i>Eliminar</a></td>
                </tr>
                {/Contactos}

Это мой JS:

function InsertPhoneNumber(){
var Nome = document.getElementById("Nome").value;
var Numero = document.getElementById("Numero").value;

jQuery.ajax({
  type: "POST",
  url: 'http://localhost/projeto/index.php/Backoffice_Controller/InserirContactos',
  data: {Nome: Nome, Numero: Numero},
  success: function (response) {
    NumberTable.draw();
    console.log("success");
    console.log(response);
  },
  error: function(response){
    console.log("error");
    console.log(response); 
  }
});
}

Инициализация Datatables:

var NumberTable = $('#table_id').DataTable({

"bPaginate": false,
"bLengthChange": false,
"bFilter": true,
"bInfo": false,
"bAutoWidth": false,
"searching": false, 
 });

Она выводит мне сообщение об успешном завершении и вставляет данные в мою базу данных, но не выдает никаких ошибок, нет, перерисовывает мою таблицу, какая помощь, пожалуйста?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...