I have a datatable and in each line I have 3 inputs (text, datepicker and select) and a button, which will send PHP, to record what was typed or selected in the inputs of that row. What I'm trying to do is grab the information from the line on which I push the button. What I thought of doing is serializing the table and transforming into an array using JQuery; the problem is that it brings information from all the lines of the datatable , but what I need is just the line that I press the button.
I can not get the values by id of the inputs because the datatable is populated automatically by PHP.
Follow the code below:
var table = $('#tableList').DataTable();
$("#tableList").on("click", ".btnReceived", function() {
var data = JSON.stringify(table.$('input, select').serializeArray());
console.log(data);
});
Following is the HTML where the button is created:
<a class='btn btn-orange btn-xs btnReceived' href='#' title='Confirmar Recebimento'><span class='glyphicon glyphicon-saved'></span><a/>