0
reference link: http://www.dapweb.org/dapdaniel/rosiane/temporada.php
I have a form with some options arranged in check boxes, to change them according to the click I am using AJAX, the following code:
function function1() {
$('.form-check-input').on('change', function() {
$('.form-check-input').not(this).prop('checked', false);
$.ajax({
url: "ajax/temporadacheckbox.php",
type: "POST",
async: true,
cache: false,
data: {
tipo: $('input:checkbox:checked').val()
},
success: function(data) {
$("#grid").hide(),
$('#grid2').html(data);
}
});
});
}
The div grid2, comes correctly and dynamically from another PHP page.
Example of dynamic div:
<div class="product-item bg-light">
<div class="card">
<div class="thumb-content">
<!-- <div class="price">$200</div> -->
<a href="resumo.php?cidade=$cid&categoria=temporadas&id=$id">
<img class="card-img-top img-fluid" src="imagens/$foto" alt="Card image cap">
</a>
</div>
<div class="card-body">
<h4 class="card-title"><a href="resumo.php?cidade=$cid&categoria=temporadas&id=$id">$nome</a></h4>
<ul class="list-inline product-meta">
<li class="list-inline-item">
<a href="resumo.php?cidade=$cid&categoria=temporadas&id=$id"><i class="fa fa-folder-open-o"></i>Hospedagens</a>
</li>
</ul>
<p class="card-text">$texto</p>
<div class="product-ratings">
<ul class="list-inline">
<li class="list-inline-item selected"><i class="fa fa-star"></i></li>
<li class="list-inline-item selected"><i class="fa fa-star"></i></li>
<li class="list-inline-item selected"><i class="fa fa-star"></i></li>
<li class="list-inline-item selected"><i class="fa fa-star"></i></li>
<li class="list-inline-item"><i class="fa fa-star"></i></li>
</ul>
</div>
</div>
</div>
The two run inside a form, which fill in the information according to the request, the grid2 div, must only filter the selected category.
I wish that when the user has no check box checked, I show the original div, the div grid, how can I do?
explain better what you want to do, I didn’t understand very well.
– Dudut
I have a form with some input check box, from which you can only select one at a time, when you click one option and switch to another, it loads the div corresponding to the checkbox that you selected correctly. However, when there is no checkbox selected, it shows nothing. I want to show the original div when nothing is selected. Note: when entering the page, before selecting any check, it shows the div that I want to display, only after selecting any of them and undo the selection that the displayed div is empty.
– Daniel Gomes Da Silva Moreira
Let me get this straight,
div
with theid=grid
corresponds todiv
What do you want to show when there is no checkbox selected?! Right??– Cristiano Gilberto João