How can I make an editable value from a database to calculate an amount in AJAX?

-2
//para agregar servicios (valores en campos ocultos)
$("#btn-agregar-servicio").on("click",function(){
    data = $(this).val();
    if (data !='') {
        infoservicio = data.split("*");
        html = "";
        html += ""+infoservicio1+"";
        html += ""+infoservicio[2]+"";
        html += "";
        html += ""+infoservicio[2]+"";
        html += ""; html += ""; 
        $("#tbordenes tbody").append(html); 
        sumarOrden(); 
        $("#btn-agregar-servicio").val(null); 
        $("#servicio").val(null);
    }else{
        alert("Seleccione un servicio válido ..."); 
    }
});
// columna de detalle servicio para tabla
$(document).on("keyup","#tbordenes input.cantidades", function(){
    cantidad = $(this).val();
    precio = $(this).closest("tr").find("td:eq(1)").text();
    importe = cantidad * precio;
    $(this).closest("tr").find("td:eq(3)").children("p").text(importe.toFixed(2));
    $(this).closest("tr").find("td:eq(3)").children("input").val(importe);
    sumar();
});

    
asked by Victor Castro Sánchez 02.01.2019 в 01:28
source

0 answers