H
H
Herman Martin2018-05-14 13:24:45
Yii
Herman Martin, 2018-05-14 13:24:45

How to make it so that the original url doesn't change when using Pjax?

<?php
    Pjax::begin([]);
    $typeForm = ActiveForm::begin([
        'action' => ['/post/add-type2'],
        'options' => [
            'class' => 'addType',
            'data' => ['pjax' => true],
        ]
    ]);
    // данные формы и закрытие формы и pjax-а
?>

in the handler is:
// логика обработчика
return $this->render('multiple',compact('types'));

Everything works as it should, data is written and output, only 1 moment. How to force PJax not to change the current url? The output is.../post/add-type2, i.e. the content of the action parameter, but it is necessary that it does not change. The handler worked well and well, but there is no need to change the link. How to make such a thing?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Bukharev, 2018-05-14
@dklight

vendor/yiisoft/yii2/widgets/Pjax.php

/**
     * @var bool whether to enable push state.
     */
    public $enablePushState = true;
    /**
     * @var bool whether to enable replace state.
     */
    public $enableReplaceState = false;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question