For Example, i have session ‘globalunit’, and i want to set that session value use setState function. so i make actionSetUnit and actionGetUnit function in my Controller class to be called in my View class by ajax
//to set globalunit
public function actionSetUnit(){
Yii::app()->user->setState('globalunit',$_POST['unit']);
}
//to get globalunit
public function actionGetUnit(){
echo Yii::app()->user->getState('globalunit');
}
i often call actionSetUnit in my view, when i change/click my combo unit in my view. but when i call getUnit function in my view to show globalunit value, the result/respons unstable. sometime the respons is true according the last unit i choose in combo Unit. sometime the respons is false (not change according the value of the last unit i choose in combo unit) …
Maybe i too much call setState function to set value session with same name.
any missing in my code??