jQuery validate不会在提交处理程序中调用我的脚本

时间:2013-06-13 04:04:21

标签: jquery jquery-validate

我已经在电路板上搜了好几个小时了,所以请不要嗤之以鼻。

以下内容不会从jQuery调用我的表单处理程序

<body>
<h1>Request A Consultation</h1>
<form id="consult_request" name="consult_request" method="post" action="">
  <table width="500" border="0" cellspacing="5" cellpadding="0">
    <tr>
      <td width="132"><label for="firstName">First Name</label></td>
      <td width="353"><input type="text" name="firstName" id="firstName" class="input required" /></td>
    </tr>
    <tr>
      <td><label for="lastName">Last Name</label></td>
      <td><input type="text" name="lastName" id="lastName" class="input required" /></td>
    </tr>
    <tr>
      <td><label for="emailAddress">Email Address</label></td>
      <td><input type="email" name="emailAddress" id="emailAddress" class="input required" /></td>
    </tr>
    <tr>
      <td><label for="emailConfirm">Verify Email Address</label></td>
      <td><input type="email" name="emailConfirm" id="emailConfirm" class="input required" equalTo="#emailAddress" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="button" id="button" value="Send Request »" class="button"  /></td>
    </tr>
  </table>
</form>
<script>
  $('#consult_request').validate({
    submitHandler: function(form){
        jQuery(form).ajaxSubmit({url: '/_interface/process/testvars.asp', type: 'post'});
    }
  });
</script>
</body>
</html>

注意:我只使用布局表bc它的遗留代码。我自己也比较清楚。

我的表格位于/_interface/content/popups/request.asp

1 个答案:

答案 0 :(得分:0)

所需的属性不应该在课堂之外吗?

<table width="500" border="0" cellspacing="5" cellpadding="0">
<tr>
  <td width="132"><label for="firstName">First Name</label></td>
  <td width="353"><input type="text" name="firstName" id="firstName" class="input" required/></td>
</tr>