jquery 检查最少字符数并发送表格

jquery check minimum characters and send form

我有这个脚本,它可以很好地检查最小字符数。但如果检查没问题,我想将表格发送到更新页面。此脚本非发送操作 post。

<form method="POST" id="myform" action="confirm.php">
<label for="field">Required, minimum length 3: </label>
<input type="text" class="left" id="field" name="field">
<br/>
<input type="submit" value="Validate!">
</form>

<script>
jQuery.validator.setDefaults({
  debug: true,
  success: "valid"
});
$( "#myform" ).validate({
  rules: {
    field: {
      required: true,
      minlength: 3
    }
  }
});
</script>

我该如何解决?

This script non send action post.

它没有发送任何东西,因为你已经将 debug 选项设置为 true

jQuery.validator.setDefaults({
    debug: true,  // <- BLOCKS form submit for testing purposes
    ....

查看文档:jqueryvalidation.org/validate/#debug

If true, the form is not submitted and certain errors are displayed on the console...