使用jquery验证和jquery时,在chrome上未禁用常规提交

使用jquery验证和jquery时,在chrome上未禁用常规提交,jquery,forms,validation,google-chrome,Jquery,Forms,Validation,Google Chrome,jqueryv1.7.1和jqueryvalidate v1.9 验证可以在Firefox 11.0上进行,但不能在Chrome上进行(进行验证,但如果验证失败,提交处理程序不会阻止提交)。表单中使用的所有字段都有一个“type”(文本和密码-我也尝试过简单地使用文本,但似乎不起作用) 任何想法/建议都是受欢迎的——如果不是,我将回到这两个库的旧版本(建议哪两个版本的工作没有问题也是受欢迎的) JSFIDLE似乎没有报告任何问题 HTML: <form class="visual" met

jqueryv1.7.1和jqueryvalidate v1.9

验证可以在Firefox 11.0上进行,但不能在Chrome上进行(进行验证,但如果验证失败,提交处理程序不会阻止提交)。表单中使用的所有字段都有一个“type”(文本和密码-我也尝试过简单地使用文本,但似乎不起作用)

任何想法/建议都是受欢迎的——如果不是,我将回到这两个库的旧版本(建议哪两个版本的工作没有问题也是受欢迎的)

JSFIDLE似乎没有报告任何问题

HTML

<form class="visual" method="post" name="login" id="login" action="login"     autocomplete="on">       
<input type="email" id="email" name="email" maxlength="40" placeholder="Email Address" autofocus="autofocus" required="required" class="formInput"/><br/><br/>
<input type="password" id="password" name="password" maxlength="20" placeholder="Password" minlength="5" required="required" class="formInput"/><br/><br/>
<input type="submit" value="Log In"/><br/>
</form>​
jQuery(document).ready(function() {
var v = jQuery("#login").validate({
submitHandler: function(form) {
var data =  jQuery.toJSON(jQuery('#login').serializeArray());
{
var ajaxResponse = jQuery.ajax({
type: "post",
url: "login",
contentType: "application/json",
data: data,
timeout: 5000,
success: function(data) {
if (jQuery.parseJSON(data).indexOf("Invalid") == -1) {
jQuery('#displayResponse').html(jQuery.parseJSON(data));
window.location.replace("/" + jQuery.parseJSON(data)); 
}
else if (jQuery.parseJSON(data).indexOf("Invalid") != -1) {
jQuery('#displayResponse').html(jQuery.parseJSON(data));
} else {
jQuery('#response').html(jQuery.parseJSON(data));
window.location.replace("/"); 
}
},
error:function (xhr, ajaxOptions, thrownError){
jQuery('#displayResponse').html('unable to submit message - please check form fields and network connection');
} 
});
}
return false;
}
});

});

当我尝试它时,该代码工作正常,因此您可能有其他原因导致该代码根本无法工作,请参见:submitHandler仅在表单验证后才会被调用,此时,submitHandler函数中存在错误-jQuery中没有
toJSON
函数。在chrome中查看您的控制台。感谢您的回复-感谢。我使用的是jQueryJSONV2.3(我在前面的注释中忘了提到)。这个问题被报告为github上jQueryValidate1.9的一个bug(它似乎没有关闭),因此我认为应该进行更多的调查(我也将更详细地检查我的代码)。欢迎提出任何其他建议。