/** * @throws Exception */ public function actionAdd() { $medicationId = $this->request->getParam('medication_id'); if (!Yii::app()->request->isAjaxRequest) { $this->render('errorpage', array('errormessage' => 'notajaxcall')); } else { if (!is_numeric($medicationId)) { echo 'error'; } else { $newCSD = new CommonMedications(); $newCSD->medication_id = $medicationId; if ($newCSD->save()) { echo 'success'; } else { echo 'error'; } } } }
/** * @throws Exception */ public function actionAdd() { $medicationId = $this->request->getParam("medication_id"); if (!Yii::app()->request->isAjaxRequest) { $this->render("errorpage", array("errormessage" => "notajaxcall")); } else { if (!is_numeric($medicationId)) { echo "error"; } else { $newCSD = new CommonMedications(); $newCSD->medication_id = $medicationId; if ($newCSD->save()) { echo "success"; } else { echo "error"; } } } }