0
I need to take the information from a JS file (form.js) and load it into a PHP file (mail.php).
In the form.js file there is a function that calculates the value of the delivery based on the CEP groups. Here is its variable:
var taxadeentrega = total - taxa;
Below is an excerpt from the code for your understanding:
//aqui eu pego o cep
var cep = document.getElementById("cep").value;
//verifica se deve incrementar ou não
if(cep == "20010-090" || cep == "20020-100" || cep == "20021-130" || cep == "20021-315" || cep == "20030-901" || cep == "20030-021" || cep == "20210-030" || cep == "24220-280"){
//se for um dos ceps acima, incrementa 1.2 no valor final
taxa = 1.50;
}
if(cep == "20020-010"|| cep == "22050-032" || cep == "20020-040" || cep == "20020-080" || cep == "20030-905" || cep == "24220-031" || cep == "20002-010" || cep == "20030-015"){
//se for um dos ceps acima, incrementa 0.7 no valor final
taxa = 1.00;
}
total += taxa;
if(taxa != 0){
//caso a taxa seja diferente de 0, mostra ao usuário
document.getElementById("idTaxa").innerHTML = "Custo adicional: R$ " + taxa;
}
This is the value of the delivery, I need this information to be loaded in my mail.php file where today it pulls straight from the form field like this:
$entrega = $_POST["taxadeentrega"];
I need that information properly to apply another rule.
In short, I need $entrega = VALOR_DA_TAXA
which will be pulling from the form.js file
If the receipt is by a
POST
, there should be a sending of form for receipt or, a sending AJAX for the PHP page. There are these negotiations?– William Aparecido Brandino
You can use GET method?
– Renato Junior