Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

98
Visualizações
JS Datatable not displaying AJAX response

Datatable is not displaying the response of an AJAX call to flask backend.

The data is retrieved as I can see it in the console.log of the success field of the AJAX call, however its not populating in the table.

Here is the JSON:

{'events': 
 [
  {
   'TIME': 'Evening', 
   'DESCRIPTION': 'test1'
  }, 
{
   'TIME': 'Morning', 
   'DESCRIPTION': 'test2'
  }
 ]
}

This is the JS part:

function load_table() {
    var payload = {'from_date': $('#from_date').val(), 'to_date': $('#to_date').val()}

    $('#table').DataTable({
        pageLength: 50,
        paging: true,
        ajax: {
            url: "data/get-events/" + JSON.stringify(payload),
            dataType: "json",
            type: 'GET',
            error: function(e){
                alert(e);
            },
            success: function(e){
                console.log(e);
            },
            dataSrc: 'events'
        },
        columns: [
        { title: 'Time', data: 'TIME'},
        { title: 'Event', data: 'DESCRIPTION'}
    ],
        bDestroy: true,
    });


}

I tried the tens of answers to my similar question but none of them worked.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda