JSON invalidated in DataTable

1

Code for Datable

$('#alumno').dataTable( {
  "ajax": {

    "url": "aprendizaje/alumnos/select",
    "dataSrc": "",
    "columns": [
            { "data": "id" },
            { "data": "matricula" },
            { "data": "nombre" },
            { "data": "apellido1" },
            { "data": "apellido2" },
            { "data": "genero" },
            { "data": "fechanacimiento" },
            { "data": "entidadnacimiento" },
            { "data": "curp" }

    ]
  },

});

This is the JSON that the server returns to me:

[{
  "id": "13",
  "apellido1": "Jimenez",
  "matricula": "17001",
  "nombre": "Ruben",
  "curp": "dddd",
  "genero": "H",
  "fechaNacimiento": "10\/22\/93",
  "entidadNacimiento": "NT",
  "apellido2": "Hernandez"
}, {
  "id": "14",
  "apellido1": "Rivas",
  "matricula": "17009",
  "nombre": "Jos\u00e9 Alejandro",
  "curp": "RIHA102293HNTLVR01",
  "genero": "H",
  "fechaNacimiento": "10-22-93",
  "entidadNacimiento": "NT",
  "apellido2": "Hernandez"
}]
    
asked by Alejandro1022 20.10.2017 в 14:53
source

1 answer

0

You must close the Ajax key before defining the columns "ajax": {       "url": "learning / students / select",       "dataSrc": ""       },  "columns": [             {"data": "id"},             {"data": "enrollment"},             {"data": "name"},             {"data": "surname1"},             {"data": "surname2"},             {"data": "gender"},             {"data": "birthdate"},             {"data": "birthdate"},             {"data": "curp"}

]
    
answered by 05.11.2017 в 04:33