facetwp change facet name on submit

/** for https://facetwp.com/how-to-display-results-on-a-separate-page/
 ** to use a facet of different type but same values between search
 ** and results page, the facet url vars need to be modified on
 ** submit
 **/
(function($) {
    $(document).on('click', '.fwp-submit', function() {
        var href = $(this).attr('data-href');
        var search_string = window.location.search;
        var search_modified = search_string.replace('category_dropdown', 'category_checkboxes');
        window.location.href = href + search_modified;
    });
})(jQuery);