Yii2 Ajaxvalidation not working

I want to enable ajax validation but I’m getting this error:

exception 'yii\base\InvalidConfigException' with message 'Unsupported response format: yii\web\Response' in /home/192/public_html/saas/vendor/yiisoft/yii2/web/Response.php:932

I have include this piece of code:

in my config file:

'response' => [

		'format' => 'yii\web\Response',

		//'charset' => 'UTF-8',		


in my form:

            $form = ActiveForm::begin([		

			'id' => $model->formName(),        

			 'enableClientValidation' => false,

			'enableAjaxValidation' => true,		



in my controller:

 public function actionCreate(){

        $model = new Jobs;

		if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {

			Yii::$app->response->format = Response::FORMAT_JSON;

			return ActiveForm::validate($model);



It’s been some time so you probably solved it but in case someone else finds this:

You need to write "use yii\web\Response;" in a separate line or \yii\web\Response::FORMAT_JSON; inline.