Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

245
Views
how to send data with edit or delete ajax request in datatable jquery

There are many questions and answers related to send data with ajax request in datatable jquery. But I didn't find how to send data when default datatable delete button clicked in ajax request

I know this is confusing so I show you some code and images

 $('#sample_data').on('draw.dt', function(){
  $('#sample_data').Tabledit({
   url:'action2.php',
   dataType:'json',
   columns:{
    identifier : [1, 'sub_category_id'],
    editable:[[5, 'GST'], [6, 'price'],
    [8, 'Commission'], [10, 'discount']]
   },
   restoreButton:false,
   onSuccess:function(data, textStatus, jqXHR)
   {
    if(data.action == 'delete')
    {
     $('#' + data.id).remove();
     $('#sample_data').DataTable().ajax.reload();
    }
   }
  });
 });

see this is default code of datatable jquery for edit or deleting data.

now I also show you initialized datatable jquery code

$(document).ready(function(){
    
    var dataTable = $('#sample_data').DataTable({
      "processing" : true,
      "dom": "<'row'<'col-sm-3'l><'col-sm-2'<'#selecttype'>><'col-sm-3'<'#activelist'>><'col-sm-4'f>>" +
             "<'row'<'col-sm-12't>>" +
             "<'row'<'col-sm-6'i><'col-sm-6'p>>",
      "serverSide" : true,
  "order" : [[1,"asc"]],
  "ajax" : {
    url:"action2.php",
    type:"POST",
    data: {                 <<-------------=
      fetch: "fetch",
      "status" : function(){
        try{
          console.log("trying ... ");
          return document.querySelector("#activelistbox").value;
        }catch(e){
          console.log("message "+e);
          return "Active List";
        }
      },
      "type" : function(){
        try{
          console.log("trying ... ");
          return document.querySelector("#selectbox").value;
        }catch(e){
          console.log("message "+e);
          return "All";
        }
      }
    }
  }
}
};

see here I use data parameter to send data.

now I show you table image

This is table image

This is payload data payload data image

Now please tell me how can i send data

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!