I can't seem to find a working example to solve this problem:
I have a view with a form, I need to get data from the DB when user submits the form and update the view without reloading.
My understanding is I need a script that listens for the submit button clicked, passes the data to to controller, the controller gets the data from the DB and returns data in JSON form so that I can use it to fill the view.
You could use jQuery or Zepto (many other javascript libs can do it aswell)
Basicly you listen to the submit event of the form (javascript in your case) then prevent it, modify your data (validate aswell) as u wish, then let the prevented event go along, then your laravel project should have a route specified in the form, get the data, validate, handle it with the query builder or with a model, and make a response to the ajax call.
here is a video about it: https://www.youtube.com/watch?v=mMMz-p-N8rs
dont forget to validate your data either in client side and server side.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community