public function actionAjax_Create() { if (isset($_POST['ContactGroups'])) { $model = new ContactGroups(); //set the submitted values $model->attributes = $_POST['ContactGroups']; //return the JSON result to provide feedback. if ($model->save(false)) { echo json_encode(array('success' => true, 'id' => $model->primaryKey)); exit; } else { echo json_encode(array('success' => false)); exit; } } }
public function actionAjax_Create() { if (isset($_POST['ContactGroups'])) { $model = new ContactGroups(); $model->created_by = Yii::app()->user->id; $model->created_at = date('Y-m-d H:i:s'); $model->status = 1; //set the submitted values $model->attributes = $_POST['ContactGroups']; //return the JSON result to provide feedback. if ($model->save(false)) { echo json_encode(array('success' => true, 'id' => $model->primaryKey)); exit; } else { echo json_encode(array('success' => false)); exit; } } }