/**
  * override needed to check if its ajax, the redirect will be by javascript
  */
 public function redirect($url, $terminate = true, $statusCode = 302)
 {
     if (!Yii::app()->getRequest()->getIsAjaxRequest()) {
         return parent::redirect($url, $terminate, $statusCode);
     } else {
         if (is_array($url)) {
             $route = isset($url[0]) ? $url[0] : '';
             $url = $this->createUrl($route, array_splice($url, 1));
         }
         echo CHtml::script("window.top.location='{$url}'");
         if ($terminate) {
             Yii::app()->end($statusCode);
         }
     }
 }