I do not have access to the models file because the software is encrypted. Currently my Checkboxes are running with Ajax inside a PHP query. Since it works with Ajax, I cannot perform any action with the URL. I want to fetch URL Parameters and only go to the data of those parameters, but I can't. Could you help ?
My Codes on the category page
<?php if ($urun_markalar) { ?>
<div >
<h3 >Markalar</h3>
<div >
<input type="text" placeholder="Arama Yap">
<div ><span ><i ></i></span></div>
</div>
<ul style="max-height: 12rem;" data-simplebar data-simplebar-auto-hide="false">
<?php
$i=0; foreach ($markalar as $marka) { $i ;
foreach ($urun_markalar as $key ) {
if ($marka->marka_id==$key) { ?>
<li >
<div >
<input type="checkbox" id="marka_<?=$i?>" value="<?php echo $marka->marka_id ?>">
<label for="marka_<?=$i?>"><?php echo $marka->marka_ad; ?></label>
</div>
</li>
<?php
}
}
}
?>
</ul>
</div>
<?php } ?>
An example of the parameter I want to perform
https://example.com/kategori/agiz-dis/agiz-calkalama-sulari?id=marka_32
In short, when I click on a checkbox from here, I want to see its URL address.
CodePudding user response:
First, get the id of the element (or you can loop through the class of checkbox). add onChange handler, and do whatever you want.
$('#marka_1').change(function() {
if(this.checked) {
$(this).prop("checked", true);
}
const markaId = $(this).val();
});
'marka_1' is the example of id checkbox, you can use class.