Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

99
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda