*/ trait AjaxValidationTrait { /** * Performs ajax validation. * * @param Model $model * * @throws \yii\base\ExitException */ public function performAjaxValidation(Model $model) { if (\Yii::$app->request->isAjax && $model->load(\Yii::$app->request->post()) && \Yii::$app->request->get('validate', '0') == '1') { \Yii::$app->response->format = Response::FORMAT_JSON; \Yii::$app->response->data = ActiveForm::validate($model); \Yii::$app->response->send(); \Yii::$app->end(); } } }