public function actionOrder() { $app = Yii::$app; $order_partial = '_services'; if (!$app->request->isAjax) { throw new \yii\web\NotFoundHttpException(); } $model = new ContactForm(['scenario' => 'order']); if ($app->request->isPost && $model->load($app->request->post())) { if ($model->sendOrderEmail()) { $model = new ContactForm(['scenario' => 'order']); $order_partial = '_order'; } $this->ivars['order_model'] = $model; } return $this->renderPartial($order_partial); }