I'm just wondering how to submit forms with Ajax in Laravel
Laravel itself doesn't provide useful tips or workflow in its documentation
Is there some usefull library idealy as extension of jquery?
Im searching for unobtrusive javasctipt solution
You are looking for https://github.com/whipsterCZ/laravel-ajax
It does exactly what you want and much more!
sending forms via ajax is simple like this - no configuration needed
HTML
<form action="" class="ajax">...</form>
Controller
public function update(ClientRequest $request, Client $client)
{
$client->update($request->all());
$request->session()->flash('success', 'Client has been updated.');
return \Ajax::redirect(route('clients.index'));
}
It also validate form (through custom FormRequest) and shows errors (in errorBag or directly above inputs)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With