I validate my form with both client and sever side scripting. First I validate it with jQuery then it goes to php validation and if it returns success or something like that I want to submit the form but some how the condition does not work. However in html err_msg
I get success text but its not working.
我使用客户端和服务器端脚本验证我的表单。首先我用jQuery验证它,然后它进入php验证,如果它返回成功或类似的东西,我想提交表单,但有些条件如何不起作用。但是在html err_msg中我获得了成功文本,但它不起作用。
jQuery.validator.setDefaults({
submitHandler: function () {
var name = $na('#inf_field_FirstName').val();
var password = $na('#inf_field_Password').val();
var cpass = $na('#cpass').val();
var email = $na('#inf_field_Email').val();
var age = $na('#inf_custom_Age').val();
$na.ajax({
type: "POST",
url: '<?php bloginfo('
template_url ')?>/user_create.php',
data: 'name=' + name + '&email=' + email + '&password=' + password + '&cpass=' + cpass + '&age=' + age,
cache: false,
success: function (result) {
jQuery('.err_msg').html(result);
if (jQuery('.err_msg').html == 'sucess') {
jQuery("#inform").submit();
} else {
alert('error');
}
}
});
}
});
1 个解决方案
#1
0
use jQuery("#inform")[0].submit();
otherwise, if u have submit button in your form just trigger that button
否则,如果您在表单中有提交按钮,则只需触发该按钮
jQuery("#submit_btn_id").trigger('click')
#1
0
use jQuery("#inform")[0].submit();
otherwise, if u have submit button in your form just trigger that button
否则,如果您在表单中有提交按钮,则只需触发该按钮
jQuery("#submit_btn_id").trigger('click')