jeudi 1 juin 2017

ajax jquery datatable not return datas on table

I am using jquery datatable use it from external cdn

<script src="http://ift.tt/2reL99Z"></script>

and my table is

  <table class="table table-bordered data-table" id="blocked_list">
            <thead>
                <tr>
                    <th>User Name</th>
                    <th>Email</th>
                    <th>Action</th>
                </tr>
            </thead>
            </table>

and cal this in jquery function

@section('script')
<script>
$('#blocked_list').DataTable({
    "ajax": "",
    "columns": [
        { data: 'id' },
        { data: 'buyer_id'},
        { data: 'seller_id' },
    ]
});
</script>
@endsection

here i think i done correctly but the data not displayed inside my table and i call data from my controller is:

  public function all(){
      $user = Auth::user();
      $block = Block::all();
      $bl = Block::where('buyer_id',$user->id)->get();
      return Response::json([
            'data' => $block
      ], 200);
    }

my controler having following values inside data variable

{"data":[{"id":1,"seller_id":12,"buyer_id":11,"email":"","created_at":"2017-06-01 11:37:54","updated_at":"2017-06-01 11:37:54"},{"id":2,"seller_id":10,"buyer_id":11,"email":"","created_at":"2017-06-01 14:20:51","updated_at":"2017-06-01 14:20:51"}]}

when thevalues not displayed inside myy laravel table i doknow why can anyone please help to solve this issue.



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

Aucun commentaire:

Enregistrer un commentaire