samedi 13 octobre 2018

Append view from controller to blade

I need to make a live search for a data with very complicated sql thus eliminate their relationship. i stored the data inside multiple array. i use append as i did for my other code but this time it is not working. please help me guys.

this is my blade with ajax.

//blade
<div class="col-md-12" style="    background-color: white;
    padding: 15px;">
      <table class="table">
    <thead>
      <tr>
        <th>Interview Place</th>
        <th>Total Application</th>
        <th>Interview Date</th>
        <th>Interview Called</th>
        <th>Interviewed</th>
        <th>Total Offered</th>
      </tr>
    </thead>
    <tbody>
    @foreach($tests as $test)
    <tr>
        <td></td>
        <td></td>
        <td>@foreach($test['date'] as $datef)<br>@endforeach</td>
        <td>@foreach($test['total'] as $total_iv_date)<br>@endforeach</td>
        <td>@foreach($test['iv'] as $total_interviewed)<br>@endforeach</td>
        <td></td>
    </tr>
    @endforeach
    </tbody>
  </table>
    </div>

//ajax
<script>
        $(document).ready(function(){
            $(document).on( "change", "#filterVacancy", function() {
                searchDashboard();
            });

            function searchDashboard()
            {
                var vacancyId=$('#filterVacancy').val();

                $.ajax({
                    type: "POST",
                    url : "",
                    data:{
                        'vacancyId':vacancyId
                        '--}}
                    },
                    cache : false,
                    success : function (data) {
                       $('.tbody').html(data);
                    }
                })
            }
        });
    </script>

this is my controller. let say that user choose a vacancy, this table below will replace the original table in the blade. i have an error at foreach date, total, and iv. please help me.

 foreach ($tests as $test) {
                $output.='<tr>'.
                    '<td>'.$test['name'].'</td>'.
                    '<td>'.$test['apply'].'</td>'.
                    '<td>'.foreach($test['date'] as $datef){ $datef;}.'<br></td>'.
                    '<td>'.foreach ($test['total'] as $total_iv_date) $total_iv_date.'<br>'.endforeach.'</td>'.
                    '<td>'.foreach ($test['iv'] as $total_interviewed) $total_interviewed.'<br>'.endforeach.'</td>'.
                '<td>'.$test['offer'].'</td>'.
                    '</tr>';
            }

            return Response($output);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire