如何用ajax和.htaccess重写url?

I'm trying to make a filter menu that filter the products by one or more parameters, but the problem is that I don't know how to properly rewrite the url using ajax. So I'm asking for your help. I need to use ajax to concatenate the value of the checked input the user select in the url like this: http://localhost/store-oop/category/filter&id=1 if there is only one filter, but if there is two or more it should be like this: http://localhost/store-oop/category/filter&id=1&id_genre=2.

.HTACCESS

<ifModule mod_rewrite.c>

RewriteEngine on
ErrorDocument 404 http://localhost/store-oop/error/

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^(.*)/(.*) index.php?controller=$1&action=$2
</ifModule>

PHP

<div class="filter-menu">
<form>
    <div class="form-wrapper">
        <div class="input-wrapper">
            <button class="navbar-button form-label" type="button" id="gender-btn">GENDER <span class="form-span"><i class="fas fa-caret-down"></span></i></button>

            <div class="gender-wrapper" id="gender">
                <label class="label-wrapper" for="man">MAN
                    <input type="checkbox" name="id_genre" id="man" value="1">
                    <span class="checkmark"></span>
                </label>

                <label class="label-wrapper" for="woman">WOMAN
                    <input type="checkbox" name="id_genre" id="woman" value="2">
                    <span class="checkmark"></span>
                </label>
            </div>
        </div>

        <div class="input-wrapper">
            <button class="navbar-button form-label" type="button" id="product-btn">CATEGORY <span class="form-span"><i class="fas fa-caret-down"></span></i></button>
            <?php $category = Utils::showCategory(); ?>
            <div class="product-wrapper" id="produc-category">
            <?php while($cat = $category->fetch_object()): ?> 
                <label class="label-wrapper" for="<?=$cat->name?>"><?=$cat->name?>
                    <input class="checkbox" type="checkbox" name="id" id="<?=$cat->name?>" value="<?=$cat->id?>">
                    <span class="checkmark"></span>
                </label>
            <?php endwhile; ?> 
            </div>
        </div>

        <div class="submit-wrapper"><input class="filter-submit" onclick="productsFilters()">Filter</input>
        </div> 

    </div>
</form>