ARTICLE AD BOX
Yes — it’s absolutely possible.
Right now you're submitting each form individually because your click handler grabs the closest form and only sends that form’s values.
To submit all 5 cloned records at once, you need:
A single global button
Loop through all .myForm forms
Collect all .name and .employid values
Send them as an array in one AJAX request
I suggest you to do something like this:
<form id="mainForm"> <div class="client"> <input type="text" name="name[]"> <input type="text" name="employid[]"> </div> <button type="submit">Submit All</button> </form> <script> $('#mainForm').on('submit', function(e){ e.preventDefault(); $.ajax({ url: 'scripts/test_post.sql.php', type: 'POST', data: $(this).serialize(), success: function(data){ console.log(data); } }); }); </script>This is cleaner, easier to maintain, and avoids nested forms (which is invalid HTML).
931 silver badge7 bronze badges
Explore related questions
See similar questions with these tags.
