0
I have the following code in JS, it creates new fields when clicking the button "+":
What I would need is rescue the values that are created with the append and insert them into the Database using php. Example:
var i = 1;
$(document).ready(function() {
$('#add_div').click (function(e) {
if (i < 100) {
var a = window.document.getElementById('area')
$('#idDiv').append('<div class="form-row">\
<div class="form-group col-md-2"><input type="text" class="form-control campoDefault" placeholder="Material" onchange='+buscar_dados_sap+' name="material'+[i]+'" id="material'+[i]+'" /></div>\
<div class="form-group col-md-2"><input type="text" class="form-control campoDefault" placeholder="Descrição" name="descricao'+[i]+'" id="descricao'+[i]+'" /></div>\
<div class="form-group col-md-1"> <input type="text" class="form-control campoDefault" placeholder="Depósito" name="deposito'+[i]+'" id="deposito'+[i]+'" /></div>\
<div class="form-group col-md-1"><input type="text" class="form-control campoDefault" placeholder="UM" name="um'+[i]+'" id="um'+[i]+'" required /></div>\
<div class="form-group col-md-1"> <input type="text" class="form-control campoDefault" placeholder="QTD" name="qtd'+[i]+'" id="qtd'+[i]+'" onchange='+buscar_dados_sap+' novocampo"/></div>\
<div class="form-group col-md-2"> <input type="text" class="form-control campoDefault" placeholder="Unitátio" name="valor'+[i]+'" id="valor'+[i]+'" required /></div>\
<div class="form-group col-md-2"> <input type="text" class="form-control campoDefault" placeholder="Total" name="val_total'+[i]+'" id="val_total'+[i]+'" required /></div>\
<a href="#" class="remove"><font size="4">✘</font></a><br><br><br>\
</div>'
);
i++;
} });
// *Remove o div anterior* //
$('#idDiv').on("click",".remove",function(e) {
e.preventDefault();
$(this).parent('div').remove();
i--;
});
});