public function actionAjaxGetEntregas() { if (Yii::app()->request->isPostRequest && isset($_POST['entregador_id'])) { $array = Entrega::model()->findAllByAttributes(array('entregador_id' => $_POST['entregador_id'])); echo CJSON::encode(array('entregas' => $array)); } else { throw new CHttpException(400); } }