title: How to clear jquery validate errors
body: <p>I'm hijaxing an existing form and POSTing to the server. jQuery validate does most of the validation but if validation fails on the server we return the errors to the client as JSON.</p>
  
  <p>Below is the code that does that:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  
      $(function () {
  
          $("form").submit(function (e) {
              var $form = $(this);
              var validator = $form.data("validator");
  
              if (!validator || !$form.valid())
                  return;
  
              e.preventDefault();
  
              $.ajax({
                  url: "@Url.Action("index")",
                  type: "POST",
                  data: $form.serialize(),
                  statusCode: {
                      400: function(xhr, status, err) {                           
                          var errors = $.parseJSON(err);
                          validator.showErrors(errors);
                      }
                  },
                  success: function() {
                      // clear errors
                      // validator.resetForm();
                      // just reload the page for now
                      location.reload(true);
                  }
              });
          });
  
      });
  
  &lt;/script&gt;
  </code></pre>
  
  <p>The problem is I can't seem to clear the validation errors if the POST is successful. I've tried calling <code>validator.resetForm()</code> but this makes no difference, the error messages added by the <code>showError()</code> call, are still displayed.</p>
  
  <p>Note I'm also using the jQuery.validate.unobtrusive plugin.</p>