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

261
Vistas
How to send manual payload in jQuery Datatable?

I was working on jQuery data table without server-side caching and pagination earlier, but now I am getting API that is performing server-side pagination searching and sorting.

I have some idea about server-side functionality provided by data table but my question is how can I pass my own parameters to ajax request, I have noticed that jQuery Datatable sends a payload that contains many things but I need to send some extra information as well to the backend.

My Code-

 $('#dataTable').ready(function () {
    $('#datatable').DataTable( {
    "processing": true,
    "serverSide": true,
    "ajax":{
    "url": "API/GetDetails",
    "dataType": 'json',
    "type": "GET",
    "beforeSend": function(xhr){
     xhr.setRequestHeader("Authorization",
    "Bearer Token");
   }
  }
});

})

Is there any way to change the payload values sent to the backend while making Api request? If yes how and where I should need to edit the code.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can send custom http variables as per their documentation

https://datatables.net/examples/server_side/custom_vars.html

ex:

$(document).ready(function() {
$('#example').DataTable( {
    "processing": true,
    "serverSide": true,
    "ajax": {
        "url": "scripts/server_processing.php",
        "data": function ( d ) {
            d.myKey = "myValue";
            // d.custom = $('#myInput').val();
            // etc
        }
    }
} );

} );

about 4 years ago · Juan Pablo Isaza Denunciar
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