title: Yii2 activeform ajax submit and validation
body: <p>Currently to achieve ajax submit and validation at the same time. I'm using custom function like:</p>
  
  <pre><code>    $('.edit_form').submit(function (e) {
          e.preventDefault();
          var form = $(this);
          var formData = $(this).serialize();
          if (form.find('.has-error').length) {
              return false;
          }
  
          $.ajax({
              url: form.attr("action"),
              type: form.attr("method"),
              data: formData,
              success: function (data) {
                   ...
              },
              error: function () {
                  alert("Something went wrong");
              }
          });
  
      });
  </code></pre>
  
  <p>And here is php side, for validation my config looks like that:</p>
  
  <pre><code>$form = ActiveForm::begin([
      'id' =&gt; "some_form",
      'action' =&gt; ['user/edit'],
      'options' =&gt; ['class' =&gt; 'edit_form'],
      'enableAjaxValidation' =&gt; false,
      'enableClientValidation' =&gt; true,
  ]); ?&gt;
  </code></pre>
  
  <p>I'm sure that It's not the best way to achieve what I need. Especially this part that I use for preventing for submission in case of validation error:</p>
  
  <pre><code>    if (form.find('.has-error').length) {
          return false;
      }
  </code></pre>
  
  <p>Any suggestions? How to achieve ajax submission and validation properly using Yii 2's inbuilt settings?</p>