0
I am developing a web application with Laravel and on one of my screens I have a Customer and Contact relationship, where a client can have multiple contacts.
So in my View I have a method to add my contacts to a table. for example: I inform the fields cellular, phone and email and click add contact and it will save ...
my question is, how can I send this data to my client controller?
[EDIT]
I have a create-DIT Client screen. where I have the customer data: Name, Number, Email ... and then I have 3 cell fields, phone and email and an add button, where I inform these 3 fields and add in the table. my problem is when sending information from this table to the server.
From Front-End to Back-End in Laravel? Take a look at this https://stackoverflow.com/questions/27346205/submit-form-laravel-using-ajax In this example he is sending a new comment to be added by the controller using the add method he created
– Sveen
I could only send this via ajax? I can’t send the data via form? with all the client’s registration at once
– Bruno Silva
Form you would have to update your page and the table would be lost, go for me, use ajax and update the table using Jquery is more robust and easy to maintain. (If you want to use pure Javascript, without Jquery and Ajax, it’s also a good one)
– Sveen
The ajax you can also submit the whole form
– Sveen
I understood, but in case it would have to be by the same form :/ because so I send up this data would have to give a redirect and change the route
– Bruno Silva
then just use action="<?= $host? >+'controller/method'" in the form
– Sveen
I already have a form, and I am already sending the information ... the problem is that the table data will not ... {!! Form::open(['route' => 'customers.store', 'class'=>'form']) !!}
– Bruno Silva
Table does not load form data, only input
– Sveen
And what is the best method to pass data from a table to the controller?
– Bruno Silva
Depending on the Table Build Plugin, jquery can recover the object with the data and you send by ajax, check if it succeeded, if yes, you call another method to change the route
– Sveen
The comments just left the most confusing question, you have a table where you list customers and these customers will have contact registrations on the same page where customers are listed right? If possible you could show how your tables are to get a sense of what has been done?
– Darlei Fernando Zillmer
I will try to update my question regarding this comment you made.
– Bruno Silva