我使用jquery从数据表(矩阵,salaire,date)恢复ARRAY,现在我想将其发送到控制器,但是在我的示例中,它仅显示“ salaire,nbrj,prime”,请帮助: 我的数据表:
<form action="/mois" method="POST">
{{csrf_field()}}
<div id='form2'>
<h3>form group 2</h3>
<h4>DATE : <span id="dateE"></span></h4>
<h4>chantier : <span id="ch"></span></h4>
<div class="form-group col-md-offset-5 ">
<button class="btn btn-success add-all" type="submit" id="hide">Pointage</button>
</div>
<table class="table table-bordered" id="mytable">
<tr>
<th>Archive</th>
<th><input type="checkbox" id="check_all"></th>
<th>S.No.</th>
<th>matricule</th>
<th>nom & prenom</th>
<th>salaire net</th>
<th>nbre de jour </th>
<th>prime</th>
</tr>
@if($salaries->count())
@foreach($salaries as $key => $salarie)
<tr id="tr_{{$salarie->id}}">
<td>archive</td>
<td><input type="checkbox" class="checkbox" data-id="{{$salarie->id}}"></td>
<td>{{ ++$key }}</td>
<td>{{ $salarie->matricule }}</td>
<td >{{ $salarie->nom }} {{ $salarie->prenom }}</td>
<td><input type="hidden" name="salaire" value="{{ $salarie->salairenet }}">{{ $salarie->salairenet }}</td>
<td ><input type="text" class='input2' name="nbreJ" class="form-control" ></td>
<td><input type="text" name="prime" class="form-control" value="0"></td>
</tr>
@endforeach
@endif
</table>
</div>
</form>
代码jquery:
$('.add-all').on('click', function() {
var items = [];
let valu = $('#datePicker').val();
$("tr").each(function(i,r){
if ( i > 0 && $(r).find("input").first().prop("checked"))
{
items.push({"matricule": r.cells[3].innerText, "salaire": r.cells[5].innerText, "date" : valu })
}
});
console.log(items);
});
我的控制器:
public function addMultiple(Request $request){
dd($request->all());
}