我在php中添加了jquery validation.recently我在注册时添加了远程技术检查电子邮件。添加后我的表单不提交。我该怎么办?
<script type="text/javascript">
runAllForms();
// Validation
$(function() {
// Validation
$("form_id_name").validate({
// Rules for form validation
rules : {
email : {
required : true,
email : true,
remote: 'page.php' // page where i am checking email from database.
}
},
// Messages for form validation
messages : {
email : {
required : 'Please enter your email address',
email : 'Please enter a VALID email address',
remote: 'This email address is already taken! Try another.'
}
},
// Ajax form submition
submitHandler : function(form) {
$(form).ajaxSubmit({
success : function() {
$("from_id_name").addClass('submited');
}
});
},
// Do not change code below
errorPlacement : function(error, element) {
error.insertAfter(element.parent());
}
});
});
page.php文件
<?php
include("connect_file.php"); // connection file
header('Content-type: application/json');
$email = $_REQUEST['email'];
$query=mysql_query("select email_col from table_name where email_col = '$email' ");
if (mysql_num_rows($query) == 0) {
$output = 'true';
}
else {
$output = 'false';
}
echo $output;
?>
我该怎么办?我是jquery的先生。请帮帮我。