S
S
sanex33392015-02-24 13:29:04
Yii
sanex3339, 2015-02-24 13:29:04

Yii2. Why is the module parameter not saved when ajax request to the controller action?

I have a problem - why is the module parameter not saved during ajax request to the controller action of this module? Despite the fact that I set this parameter before the ajax request, by calling the method of the main module file:

class SanexFilter extends \yii\base\Module
{
    public $controllerNamespace = 'sanex\filter\controllers';

    public function init()
    {
        parent::init();
    }

    public function setFilter($filter)
    {
        $this->params['filter'] = $filter;
    	return $this->runAction('filter/set-filter');
    }
}

Further, when I make an ajax request to the controller action of this module, params['filter'] are empty. It is clear that with an ajax request, the assignment of $this->params['filter'] = $filter, but why is the previous setting of the parameter from the setFilter($filter) method reset?
How can I solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vyachin, 2015-06-04
@vyachin

https://ru.wikipedia.org/wiki/HTTP
In order to add persistence (I think that's what it's called), cookies and sessions were invented. Use them
https://github.com/yiisoft/yii2/blob/master/docs/g...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question