{ text: 'Mass Assign ⤴', className: 'btn btn-outline-dark font-weight-bold rounded', action: function ( e, data, dt, node, config ) { var tableToQuery = $("#dataTableSnd").DataTable(); var selectedRow = $("#dataTableSnd tr.selected"); var rowdata = tableToQuery.row(selectedRow).data(); console.log(rowdata); //console log shows me just first record if i select multiple var id = rowdata.id; if (id.length = 1) { $('#assign_form').on('submit', function(event){ event.preventDefault(); var form_data = $(this).serialize() + "&id="+id; console.log(form_data); $.ajax({ url:"{{ route('list.assignpostdata') }}", method:"POST", data:form_data, dataType:"json", success:function(data) { if(data.error.length > 0) { var error_html = ''; for(var count = 0; count < data.error.length; count++) { error_html += '