-1
In the archive .php there is a certain variable.
<?php
$freteselecionado = "<script>document.write(checado)</script>";
So I have two input of the kind radio to receive the value.
<input type="radio" id="radio_01" name="tipo_frete" value="1">
<input type="radio" id="radio_02" name="tipo_frete" value="2">
My function using jQuery, but something is going wrong.
<script>
$(function() {
let checado = false;
$( "#radio_01" ).change(function() {
var $input = $( this );
if ($input.is( ":checked" )) {
checado = true;
}}).change();
$( "#radio_02" ).change(function() {
var $input = $( this );
if ($input.is( ":checked" )) {
checado = true;
}}).change();
});
</script>
How to change the php variable value only when it is actually checked? What happens is that when the GIFT the value is already TRUE.
To do this, you will have to send the value using ajax
– Wictor Chaves
What is the purpose of your code?
– Wictor Chaves
@Wictorchaves how I could do that?
– André Martins
I am wanting to release a button on the application only if the user selects certain type of freight.
– André Martins
You can do this using javascript only :)
– Wictor Chaves
how could I do that?
– André Martins
Let’s go continue this discussion in chat.
– Wictor Chaves