1
I am developing a virtual shop where in the shopping cart I will implement the freight calculation via mail webservice.
The code below it makes the calculation and returns only the Pac option, I need that as the user selects the option sedex he makes the calculation and shows me the value related to the sedex. I am not able to implement select, it is appearing that var freight type is not set.
function LoadFrete() {
var cep_destino = $('#cep_destino').val();
//var tipo_frete = $('tipo_frete').val();
$.ajax({
url: 'ajax/a_frete.php',
type: 'POST',
dataType: 'html',
cache: false,
data: {cep_destino: cep_destino},
success: function (data) {
console.log('Valor = ' + data);
$('#valor_frete').val(data);
var val_prod = $('#valor_pro').val();
val_prod = val_prod.replace(',', '.');
data = data.replace(',', '.');
var total = parseFloat(data) + parseFloat(val_prod);
$('#valor_prodfrete').val(total);
}, beforeSend: function () {
}, error: function (jqXHR, textStatus, errorThrown) {
console.log('Erro');
}
});
}
It is undefined why the
var tipo_frete
is commented, takes the//
– Mateus Spadacio
type freight is class or id ?
– adventistaam
Good morning Matthew and Advenstistaam, even taking // she remains undefined. tipo_frete é uma variavel na função do webservice dos correios. $url .= " &nCdServico=04510,04014" . $tipo_freight; - $dados = calcula_freight('14802175', $cep_destination, 5, 1, $tipo_freight); -
– Juliano Balbis Garcia
but there you are calling from your formulary
– adventistaam