There must be something killing the session either before the redirect, or perhaps in the controller/action that the redirect points to.
Try redirecting to another controller that will simply echo ‘hello’ or whatever and see if your session still breaks. Then you know where the error is. My guess is something in “/system/settings”.
It’s not a good idea to redirect (send Headers), on AJAX requests. Why don’t you try something like this
in your target controller
public function actionSomeAction(){
if(isset($_POST['javascript'])){
//do something
//Some true / false logic
if($ok)
//add a status code to the json array
echo CJSON::encode(array('status'=>'200', 'redirect'=>Yii::app()->createUrl('/controller/action/')));
else
echo CJSON::encode(array('status'=>'500', 'redirect'=>Yii::app()->createUrl('/error/action/')));
}
}
And your JavaScript could look like this
$.post(url, function(data){
//get the url
redirect = data.redirect
//if everything is OK, redirect to that url
if(data.status == '200')
window.location.href = redirect
else
//if not, do something...
alert('Error')
}, 'json')