I have in the forms of payment of my invoice form a table for checks that appears when clicking on add. More specifically, a check row appears to enter all the data. On the right you have an action button to confirm.
The idea is that when confirming if nothing fails and the check is inserted, another row appears with edits. And in the action column instead of an accept, edit or delete (use glypicons).
$("#agregarc").click(function(){
var datoscheque='<tr><td><div>'+
'<select id="bancos"><option value"=0">Seleccione<option></select></div></td>'+
'<td><input type="text" class="form-control" id="nrocuenta" placeholder="CtaBancaria"/>'
+'</td>'+
'<td><input type="text"class="form-control" id="titular" placeholder="Titular"/></td>'+
+'<div>'+'<td><input type="text" class="form-control" id="CUIT" placeholder="CUIT"/></td>'+
'<td><input type="text"class="form-control" id="Importe" placeholder="Son pesos"/></td>'
+
'<td><input type="date" class="form-control" id="fechacobro"placeholder="Deposito el:"/></td>'+
'<td><button id="acreditar" class="btn btn-primary"><span id="acreditar" class="glyphicon glyphicon-ok"></span></button></td><td></td></tr>';
$(datoscheque).appendTo("#cheques");
listarbancos();
$("#acreditar").click(function(){
var Banco=$("#bancos").val();
var Importe=$("#Importe").val();
var nroCuenta=$("#nrocuenta").val();
var titular=$("#titular").val();
var fechacobro=$("#fechacobro").val();
var CUIT=33;
var cobrado=0;
var d = new Date();
var fecharecibo=d.getFullYear() + "-" + (d.getMonth()+1) + "-" + d.getDate();
$.ajax({
type: "POST",
url: "//localhost/gestionweb/includes/php/ingresacheque.php",
data: { "idbanco":Banco,"idc":idcliente,"num":nroCuenta,"fechar":fecharecibo,"fechac":fechacobro,"importe":Importe,"titular":titular,"cuenta":nroCuenta,"cobrado":cobrado,"CUIT":CUIT},
error: function(){
alert("error petición ajax");
},
success: function(data){
console.log(data);
}
});
$("#cheques").val(Importe);
});
});
That's how I convert the edits into labels and change the buttons?