/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionAjax($id) { $model = new Doccheques(); $type = PaymentType::findOne($id); if ($type !== null) { //return $this->renderPartial('ajax', array( return $this->render('ajax', array('model' => $model, 'type' => $type)); Yii::$app->end(); } if ($model->load(Yii::$app->request->post())) { if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } return $this->renderPartial('create', array('model' => $model)); }