, но еще нужно передать сессии (withCredentials).
public function actionValidateForm()
{
$model = new CreateOrder();
$model->load(Yii::$app->request->post());
if(Yii::$app->request->isAjax)
{
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
$model->addErrors(ActiveForm::validate($model));
}
throw new \yii\web\BadRequestHttpException('Bad request!');
}
<?php Pjax::begin(['id' => 'form-errors']);?>
<?php if($model->hasErrors()):?>
<?php foreach ($model->getErrors() as $key => $value):?>
<div class="alert alert-danger w-100 text-center" role="alert">
<?= $value[0];?>
</div>
<?php endforeach;?>
<?php endif;?>
<?php Pjax::end();?>
php artisan storage:link