I need your idea and tips on how can I make this form work. I am trying to create a rating for each candidates in each categories and each categories have 5 criteria. What I have did is to fetch the criteria dynamically in the database and display it with a input box. Now my problem is how can I save this is the database together with is criteria id as well as the score of each criteria.. Here is my code
<form class="form-horizontal" role="form">
{{ csrf_field() }}
<div class="form-group col-sm-8" >
<input type="hidden" id="canId" name="canId">
<input type="hidden" id="catId" name="catId">
<input type="hidden" id="judgeId" name="judgeId">
@foreach($dataCriteria as $Criteria)
<label class="col-sm-9" for="id">{{$Criteria->cri_name}}</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="cri_{{$Criteria->id}}" name="cri_{{$Criteria->id}}" data-crid ="{{$Criteria->id}}" placeholder="1-10" required><br>
</div>
@endforeach
</div>
<div class="col-sm-4">
<img src="{{ asset('img/girl.jpeg') }}" alt="">
<h4 class="canfname text-center"></h4>
<p class="text-center"><em class="canbrgy"></em></p>
</div></form>
and here is my ajax code but this is lacking for the input of the criteria.
$.ajax({
type: 'post',
url: 'candidates/rateCandidates',
data: {
'_token': $('input[name=_token]').val(),
'canId': $('input[name=canId]').val(),
'catId': $('input[name=catId]').val(),
'judgeId': $('input[name=judgeId]').val()
},
success: function(data) {
window.location.reload();
}
});
Please help me... Thank you
reload()with AJAX form submit? It is the against AJAX principle or basic feature!console.log('Lorem'):)