I
I
IvanKalinin2015-02-19 08:09:17
JavaScript
IvanKalinin, 2015-02-19 08:09:17

How to add a field using jQuery and pass them to Laravel?

You need to write several records to the database.
When opening the page, there is one input field. either by the "+" button, or (which is better) when you start typing, a new field appears for a new entry. by clicking on the "add" button, all completed rows are added to the database.

How to combine jQuery and Laravel in this situation, so that jQuery passes the number of rows and their values ​​​​to write to the database?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vyacheslav Barsukov, 2015-02-22
@slavabars

Add fields with name='name[]'
Input or Request can take an array as input.
Request::input('name') will return an array. And then as normal work with an array (you can disassemble it in a loop, count it using count(), etc.).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question