V
V
Voroncheg2019-09-04 20:06:58
Yii
Voroncheg, 2019-09-04 20:06:58

Yii2. How to send a variable through pjax and display it?

Hello. I'm trying to send a variable via pjax and get it processed. But it doesn't work.
this is view

<?php Pjax::begin(['enablePushState' => false]); ?>
    <?php
        $index = 0;
        echo $index;
    ?>
    <?= Html::a('Добавить адрес', ['user/dublicate-address', 'index' => $index], [
        'class' => 'btn btn-success',
    ]) ?>
<?php Pjax::end(); ?>

this is an action in the controller
public function actionDublicateAddress($index){

        $index++;

        return $this->render('test',[
            'index' => $index
        ]);
    }

It doesn't work for some reason.
Please let me know if there is any way to fix it or do it differently. There, inside pjax, the content will then dynamically change in a loop.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Derepko, 2019-09-04
@Voroncheg

remove line from view

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question