public function actionCreate($identidad) { $model = new Participacion(); $model->idsociedad = $identidad; if (isset($_POST['Participacion'])) { $model->setAttributes($_POST['Participacion']); try { if ($model->save()) { if (Yii::app()->request->isAjaxRequest) { echo CJSON::encode(array('status' => 'success', 'content' => "Socio agregado")); exit; // grabacion ok y mensaje ok } } } catch (Exception $e) { $model->addError('', $e->getMessage()); } } if (Yii::app()->request->isAjaxRequest) { Yii::app()->clientScript->scriptMap['jquery.js'] = false; echo CJSON::encode(array('status' => 'failure', 'content' => $this->renderPartial('_form', array('model' => $model), true, true))); exit; } }