public function actionKolvo() { \Yii::$app->response->format = Response::FORMAT_JSON; $model = new BookingForm(); if (\Yii::$app->request->isAjax) { if ($model->load($_POST)) { return $model->getKolvoData(); } } }
public function actionStepOne($id) { /** @var $model ProductRecord*/ $model = ProductRecord::findOne($id); if (!$model) { throw new HttpException(404, Language::t('reservation', 'Аппартаменты не найдены!')); } $formModel = new BookingForm(); $formModel->productId = $id; if (\Yii::$app->request->isAjax && $formModel->load($_POST)) { \Yii::$app->response->format = Response::FORMAT_JSON; return ActiveForm::validate($formModel); } if ($formModel->load($_POST) && $formModel->send()) { return $this->redirect($this->goBack()); } return $this->renderAjax('stepOne', ['model' => $model, 'formModel' => $formModel]); }