lundi 28 août 2017

insert data into spesific table with jquery laravel

I've 2 tables, and i'm to trying pass table value from controller into spesific table, but data show inside both table

//Controller

public function user_ajukan_uji_ajax(Request $request)
{
            $request->ajax();        
            $output="";
            $user=DB::table('user')->where('id','like','%'.$request->search.'%')->get();
            foreach ($user as $key => $user) 
            {
                $output.='<tr>'.
                         '<td>'.$user->id.'</td>'.
                         '<td>'.$user->nama_user.'</td>'.
                         '<td>'.$user->telp_user.'</td>'.
                         '<td>'.$user->email_user.'</td>'.
                         '<td>'.$user->kategori_user.'</td>'.
                         '<td>'.$user->created_at.'</td>'.
                         '</tr>';
            } 
        return response($output); 
}

//script for pass value into table

 <script >
            $('#search').on('keyup',function(){
            $value=$(this).val();
                $.ajax({
                    'type' : 'get',
                    'url' : '',
                    'data' : {'search' : $value},
                    success : function(data){
                        $('tbody').html(data); 
                        }
            });
       });
    </script>

//my table that i want to pass the value into it

<table id="data_tampil_pengguna_ajukan_uji" class="table table-responsive display" data-form="data_pengguna" style="width:100%">
        <thead>
            <tr class="danger">
                <th>Id</th>
                <th>Nama</th>
                <th>Nomor Telepon</th>
                <th>Email</th>
                <th>Kategori</th>
                <th>Tanggal Bergabung</th>
            </tr>
        </thead>
        <tbody>
                <tr>
                    <td></td>
                </tr>
        </tbody>
    </table>

Please help me.. every question is very appreciate..



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2whk4DT
via IFTTT

Aucun commentaire:

Enregistrer un commentaire