Yii2 GridView reload with pjax - double parameters

Hi,

i have a dropdownlist on my gridview to select the pagesize. If the button is changed, i call the following javascript function:

$(\'.change-pageSize\').change(function() {
    $.pjax.reload({container:"#scanports", data: "pageSize="+$(this).val()});
});

It works fine and the gridview is reloading. If i changed the selection, the new pageSize will be added to url like

http://xyz.com/scans/view?id=55&pageSize=100&pageSize=50

Is there a solution to change the pageSize parameter and not always add another parameter?

Thanks for help…

Now i have changed the code as

        <div class="card">
            <div class="card-body">
            <?php \yii\widgets\Pjax::begin(['id'=>'test']); ?>
                <?= GridView::widget([
                    'dataProvider' => $targets,
                    'filterModel' => $searchModel,

To reload pjax

$(\'.change-pageSize\').change(function() {
    $.pjax.reload({container:"#test", data: "pageSize="+$(this).val()});
});

Now i set a id for the pjax-container. If i reload now with id=test, the script only reload the Gridview. But after this, my java-scripts not working anymore. So i can’t change the count of rows for view again.

Now i found a solution that works for me on
https://stackoverflow.com/questions/52114067/how-do-i-dynamically-show-the-pagesize-in-yii2