{ 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 += '
'+data.error[count]+'
'; } $('#form_output').html(error_html); } else { $('#form_output').html(data.success); $('#dataTable').DataTable().ajax.reload(); } } }) }); $('#form_output').html(''); $.ajax({ url:"{{route('list.assignfetchdata')}}", method:'get', data:{id:id}, dataType:'json', success:function(data) { $('#assign').val(data.assign); $('#id').val(id); $('#assignModal').modal('show'); $('#action_assign').val('OK'); $("#action_assign").click(function(){ $("#assignModal").modal('hide'); }); $('.modal-title').text('Edit Data'); $('#button_action_assign').val('assign'); } }) } } },