I need to pass to letters (using a PHP script) a number that is inserted into a div by means of a calculation in Jquery. I need to put this value in a PHP variable. I can not do it. Any suggestions? Here the code:
<script type="text/javascript">
$(document).ready(function(){
//Subtotal
importe_total = 0
$("#remitosfacturados .totalservicio").each(
function(index, value) {
importe_total = importe_total + eval($(this).val());
}
);
var importe_totalEntero = importe_total;
var importe_total2Dec = importe_totalEntero.toFixed(2);
$("#remitosfacturados .subtotalfacturacion").html(importe_total2Dec);
//Calculo de IVA
var subtotal = $("#remitosfacturados .subtotalfacturacion").html();
var IVA = $("#remitosfacturados .porcentajeiva").val();
var resultadoIVA = (parseInt(subtotal) * (parseInt(IVA) / 100)).toFixed(2);
$("#remitosfacturados .iva_valor").html(resultadoIVA);
//TOTAL
var TotalFacturado = (parseInt(subtotal) + parseInt(resultadoIVA)).toFixed(2);
$("#remitosfacturados #totalfacturado").html(TotalFacturado);
});
</script>
<div class="form-title">
<div class="form-two widget-shadow">
<?php
$TotalFacturadoParaLetras = AQUÍ DEBERÍA IR EL VALOR DEL DIV #totalfacturado;
echo $TotalFacturadoParaLetras;
include ("valoresenletras.php");
$totalenletras=(string)$TotalFacturadoParaLetras;
$V=new EnLetras();
$con_letra=strtoupper($V->ValorEnLetras($totalenletras,'pesos'));
echo '<b>'.$con_letra.'</b>';
?>
</div>
</div>