@adan
To reload a DataTable after a form submit in Laravel, you can follow these steps:
1
|
Route::post('/submit-form', 'FormController@submitForm')->name('submit.form'); |
1
|
php artisan make:controller FormController |
In the FormController
, create a method to handle the form submission:
1 2 3 4 5 6 7 |
public function submitForm(Request $request) { // Handle the form submission // Example: If you want to reload the DataTable after form submission return redirect()->back()->with('reload_datatable', true); } |
1 2 3 4 5 |
<script> @if(session('reload_datatable')) location.reload(); @endif </script> |
By following these steps, the DataTable will be reloaded after the form submission in Laravel.