R
R
redesupar2022-03-25 14:04:39
1C-Bitrix
redesupar, 2022-03-25 14:04:39

How to send an array of IDs via GET in Bitrix?

I have radiobuttons

<fieldset class="filter-section">
                    <input type="radio" id="sect-id-4107" name="sect-id" value="19154,18495">
                    <label for="sect-id-4107">Шапочки</label>

                    <input type="radio" id="sect-id-4125" name="sect-id" value="4125">
                    <label for="sect-id-4125">Набородники</label>
          
                    <input type="radio" id="sect-id-4120" name="sect-id" value="4120">
                    <label for="sect-id-4120">Маски</label>
          
                    <input type="radio" id="sect-id-4171" name="sect-id" value="4171">
                    <label for="sect-id-4171">Экраны</label>
                </fieldset>

I pass it like this
$('#perchatkarf-filter').on('change', function(){
                    $.ajax({
                        url: 'ajax/index.php?ID='+$('input[name="sect-id"]:checked').val(),
                        type: 'GET',
                        beforeSend: function(){
                            $('#contentTest').css( "filter", "opacity(0.2)" );
                        },
                        success: function(res){
                            $('#contentTest').empty();
                            $('#contentTest').append(res);
                            $('#contentTest').css( "filter", "opacity(1)" );
                        },
                        error: function(){
                            alert('Error!');
                        }
                    });
                });


I try either way I try through
"ELEMENT_ID" => [$_GET["ID"]],

GLOBALS['arrFilterFav'] = array('ID' => [$_GET["ID"]]);

As a result, if in value="1,2", then it takes only 1 number. How can I get all IDs?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
tgarl, 2022-03-28
@redesupar

instead of

LOBALS['arrFilterFav'] = array('ID' => [$_GET["ID"]]);

split string by comma
= array( 'ID' => explode(',', $_GET["ID"]) );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question