I have to catch a click
event on a radio button and pass its value on a PHP variable so I can do a value calculation, I did not have much success, follow my code.
function Tipo_Frete() {
var frete = $("input[name='tipo_frete']:checked").val();
if (frete == "PAC") {
frete = 'pac'
}else if(frete == 'SEDEX'){
frete = 'sedex'
}
}
<?php $frete = "<script>document.write(frete)</script>";
What I really need now is for this variable to still be accessed in view , without going through controller . I need a PHP variable to get the value of the button
checked, so that in PHP I can do the calculation. How to make all this happen dynamically, without having to submit this together with the form, and treat everything in view ?