Save data input from a datatable as a JSON object
To save data input from a datatable as a JSON object, you can use the rows().data() method of the datatable object to retrieve all the rows in the table, and then loop through them to extract the data from the input fields. Here's an example: // get the datatable object var table = $('#example').DataTable(); // get all the data in the table var data = table.rows().data(); // create an array to store the data var dataArray = []; // loop through the rows and extract the data data.each(function (value, index) { var row = {}; row['name'] = value[0]; // assuming the first column contains the name row['email'] = value[1]; // assuming the second column contains the email row['phone'] = value[2]; // assuming the third column contains the phone dataArray.push(row); }); // convert the array to a JSON object var jsonData = JSON.stringify(dataArray); // send the JSON object to the server using AJAX $.ajax({ url: 'save-data.ph