如果我使用jQuery附加数据,则刀片视图无响应

我使用laravel并希望将我的数据从控制器传递到刀片视图并使用jquery ajax

and its going like this 当我缩小its like these ...

所以我的引导响应功能没有用

但是如果我不使用jquery并从表中手动插入数据,它会像这样example1 example2

我的jquery附加在刀片视图的底部

<script>
   $(document).ready(function(){

      $('#new-cons').DataTable({
        processing:true,serverside:true,ajax:"{{route('ajax.get.data.siswa')}}",columns:[
          {data : 'nama',name:'Nama'},{data : 'jenis_kelamin',name: 'Jenis Kelamin'},{data : 'agama',name: 'Agama'},{data : 'ratarata',name:'Nilai'},{data : 'alamat',name:'Alamat'},{data : 'aksi',name:'Aksi'},]
      });<script>

这些是我从刀片视图查看的表单

       <div class="card">
              <div class="card-header">
                  <h5>Data Siswa</h5>
              </div>
              <div class="card-block">

                <div class="dt-responsive table-responsive">
                <table id="new-cons" class="table table-striped table-bordered nowrap">
                    <thead >
                      <tr>
                        <th>Nama</th>
                        <th>Jenis Kelamin</th>
                        <th>Agama</th>
                        <th>Nilai</th>
                        <th>Alamat</th>
                        <th>Aksi</th>
                      </tr>
                  </thead>
                  <tbody>

                  </tbody>
                </table>
              </div>
              </div>
          </div

还有这些我的控制器功能

public function getdatasiswa()
{
    $siswa = Siswa::select('siswa.*');

    return \DataTables::eloquent($siswa)
    ->addColumn('ratarata',function($s){
        return $s->RataRata();
    })
    ->addColumn('aksi',function($s){
        return'<a href="#" class="btn btn-warning btn-sm">edit</a>';
    })
    ->rawColumns(['ratarata','aksi'])
    ->toJson();

}
nongdada123456 回答:如果我使用jQuery附加数据,则刀片视图无响应

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3145877.html

大家都在问