I have two categories list Gender and Brand. First category
<ul>
<li><input type="checkbox" id="checkboxa" class="chkbox" value="url.php?gender=children" name="gender"> Kid</li>
<li><input type="checkbox" id="checkboxb" class="chkbox" value="url.php?gender=male" name="gender"> Male</li>
<li><input type="checkbox" id="checkboxc" class="chkbox" value="url.php?gender=female" name="gender"> Female</li>
</ul>
Second Category
<ul>
<li><input type="checkbox" id="checkbox1" class="chkbox" value="url.php?barnd=brand1" name="brand"> Brand1</li>
<li><input type="checkbox" id="checkbox2" class="chkbox" value="url.php?barnd=brand2" name="brand"> Brand2</li>
<li><input type="checkbox" id="checkbox3" class="chkbox" value="url.php?barnd=brand3" name="brand"> Brand3</li>
<li><input type="checkbox" id="checkbox4" class="chkbox" value="url.php?barnd=brand4" name="brand"> Brand4</li>
</ul>
This is my js:
<script>
$(document).ready(function() {
$('.chkbox').on('change', function() {
if ($(this).is(':checked')) {
var url = $(this).val();
console.log(url);
window.location = url;
}
});
});
</script>
Right now my page is reloading when one item is checked. I want to make the page reload only when one item of each category is checked. Plz help... Thanks in advance.....
PS: url should be like url.php?brand=$brand&&gender=$gender $:-checked