I am developing an online store where in the shopping cart I will implement the freight calculation via the webservice of the post office.
The code below it does the calculation and returns only the option of Pac, I need that as the user select the sedex option he make the calculation and show me the value referring to sedex. I am not able to implement select, it is appearing that the var type freight is not defined.
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');
}
});
}