'pass multiple values in single parameters wordpress ajax

I have input checkbox and send to url multiple value in single paramter like this: https://lacosta-realestate.com/advanced-search/?filter_search_action%5B%5D=residential&filter_search_action%5B%5D=hotel-apartments but wordpress read the first value only and get its data only I added <input type='hidden' name='filter_search_action[]' value=""> to store more than one value for example: <input type='hidden' name='filter_search_action[]' value="val1, val2"> I need to translate these values to url and appear its items not first value

const typesArray = [];
$(".types-input").click(function(event){
    if($(this).prop("checked") == true){

        typesArray.push(jQuery(event.target).attr('data-value'));
        console.log(typesArray);
    }
})
$(".types-input").change(function(){
    $("input[name='filter_search_action[]']").val(typesArray)
    const ajaxurl = ajaxcalls_vars.admin_url + 'admin-ajax.php';
    const nonce = jQuery('#wpestate_tab_stats').val();
    
    $.ajax({
        method: "GET",
        url: ajaxurl,
        data: {
            'action': 'wpestate_load_types',
            'filter_search_action': typesArray,
            'security': nonce
        },
        success: function(data){
            $(".res-type").html(data);
            console.log(data);
            console.log(typesArray);
        }
    })
})

functions.php

add_action( 'wp_ajax_wpestate_load_types', 'wpestate_load_types' );
add_action( 'wp_ajax_nopriv_wpestate_load_types', 'wpestate_load_types' );

function wpestate_load_types(){
    global $wpdb;
    $typesVal = $_GET["filter_search_action"];

   foreach($typesVal as $k => $v){
        add_query_arg($k, $v, 'https://lacosta-realestate.com/advanced-search/');
    }

    wp_die();
}



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source