title: Yii2 ajax validation not work
body: <p>I was trying to validate my YII2 register form but it not work. In view:</p>
  
  <pre><code>$form = ActiveForm::begin([
      'id'                   =&gt; 'register',
      'options'              =&gt; ['accept-charset'=&gt;'utf-8'],
      'validateOnChange'     =&gt; false,
      'enableAjaxValidation' =&gt; true,
      'validateOnSubmit'     =&gt; true,
  ])
  </code></pre>
  
  <p>In controller:</p>
  
  <pre><code>$model = new MUser();
  
  if($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; Yii::$app-&gt;request-&gt;isAjax)
  {
      $model-&gt;refresh();
      Yii::$app-&gt;response-&gt;format = 'json';
      return ActiveForm::validate($model);
  }
  elseif($model-&gt;load(Yii::$app-&gt;request-&gt;post()) &amp;&amp; $model-&gt;save())
  {
      \\do something
  }
  </code></pre>
  
  <p>In Model:</p>
  
  <pre><code>public function rules()
  {
      return [
                 [
                     'username', 
                     'unique', 
                     'targetClass' =&gt; 'com\modules\admin\models\MUser',
                     'message'     =&gt; 'Username exist',
                 ]
             ];
  }
  </code></pre>
  
  <p>Can anyone let me know what wrong I am doing?</p>