Good morning my doubts and complex is creating a system that will create card of each registered user, to differentiate the cards each element of the card has the id of the user. I would like to know how to capture the value of the selected radio, except that the name of the radio is concatenated with the id of the user to be able to differentiate itself from the other card.
Look at the codes:
THIS CREATES THE CARD
while ($registro = mysqli_fetch_array($resultado_id, MYSQLI_ASSOC)) {
echo '<div class=" cardUser col-md-12">
<div class="cardNome">
<span>'.$registro['nome'].'</span>
</div>
<div class="cardPro">
<span class="glyphicon glyphicon-education"> '.$registro['idProfissao'].'</span>
<span class="cardPro2 glyphicon glyphicon-education"> '.$registro['idProfissao2'].'</span>
</div>
<div class="cardInfo">
<ul class="cardUl">
<li class="cardLi">
<span class="cardValue glyphicon glyphicon-globe"> '.$registro['idCidade'].'</span>
<span class="cardValue glyphicon glyphicon-earphone" id="tel"> '.$registro['telefone'].'</span>
</li>
</ul>
<div class="estrelas">
<ul class="cardUl">
<li class="cardLi">
<span class="cardLabel">Status:</span>
<span class="cardValue"> '.$registro['disponibilidade'].'</span>
</li>
<li class="cardLi">
<Form id="estrelas">
<span class="cardLabel">Avaliação:</span>
<input type="radio" id="cm_star-empty-'.$registro['id'].'" name="fb'.$registro['id'].'" value="" checked/>
<label for="cm_star-1-'.$registro['id'].'"><i class="fa"></i></label>
<input type="radio" id="cm_star-1-'.$registro['id'].'" name="fb'.$registro['id'].'" value="1"/>
<label for="cm_star-2-'.$registro['id'].'"><i class="fa"></i></label>
<input type="radio" id="cm_star-2-'.$registro['id'].'" name="fb'.$registro['id'].'" value="2"/>
<label for="cm_star-3-'.$registro['id'].'"><i class="fa"></i></label>
<input type="radio" id="cm_star-3-'.$registro['id'].'" name="fb'.$registro['id'].'" value="3"/>
<label for="cm_star-4-'.$registro['id'].'"><i class="fa"></i></label>
<input type="radio" id="cm_star-4-'.$registro['id'].'" name="fb'.$registro['id'].'" value="4"/>
<label for="cm_star-5-'.$registro['id'].'"><i class="fa"></i></label>
<input type="radio" id="cm_star-5-'.$registro['id'].'" name="fb'.$registro['id'].'" value="5"/>
</Form>
</li>
<button type="button" class="btn btn-info btn-sm btn-like" id="btn-like-'.$registro['id'].'" data-id_usuario="'.$registro['id'].'">Avaliar</button>
</ul>
</div>
</div>
</div>
';
}
This code and js that I use to send the variaves the id of the user I can capture more the value of the radio I do not know how to do.
<script type="text/javascript">
$(document).ready( function () {
$('.btn-like').click(function(){
var id_usuario = $(this).data('id_usuario');
var estrela = $(this).data('');
$('#btn-like-'+id_usuario).hide();
$.ajax({
url: 'like.php',
method: 'post',
data: { like_id_usuario: id_usuario, },
success:function (data) {
alert('Registro realizado com sucesso');
}
});
});
})
</script>