mercredi 14 février 2018

Auto update Page in Laravel

I am new to Laravel and I am making a page 'admin.blade.php' which will show the data of the user from the database and update automatically when new user registered, thats not the concern. My point is to update admin page and in doing so I am using jQuery which will take data from demo.admin.php and update the admin page.

Code in demo.blade.php:

Id Name Email @foreach($users as $value) @endforeach

Script in admin.blade.php

      $(document).ready(function() {         setInterval(function() {           $('#res').load('demo.blade.php')         },100);       });     

Code in DemoController:

public function index()

{

$users = DB::table('users')->select('id','name','email')->get();

return view('demo')->with('users', $users);

}

Code in AdminController:

public function index()

{

// return view('admin');

$users = DB::table('users')->select('id','name','email')->get();

return view('admin')->with('users', $users);

}

Plz help me out. When i open admin page. table is not showing.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire