简体   繁体   English

jQuery验证后,远程验证未提交表单

[英]jQuery validate remote not submiting form after validate

Hi I have a form that I am validating with jQuery validate. 嗨,我有一个要通过jQuery validate进行验证的表单。

It works fine but I can't get the form submitted after the remote validation returns from the server. 它工作正常,但是从服务器返回远程验证后我无法提交表单。

The php script that validates in the server is returning "true" (without quotes). 在服务器中验证的php脚本返回“ true”(不带引号)。

This is the code for my form validation: 这是我的表单验证的代码:

jQuery(document).ready(function() {
            jQuery('.datePicker').datepicker({
                dateFormat : 'dd-mm-yy',
                        autoSize: true 
            });

            // validate 
            jQuery('#ivru-report-form').validate({
                rules: {
                    date: {
                        required: true,
                        remote: {
                            url: '<?php echo admin_url('admin-ajax.php'); ?>',
                            type: "post",
                            data: {
                                action:'ivru_add_item_validate_date',
                                page: function() {
                                    return jQuery( "#ivru-hidden-page" ).val();
                                },
                                date: function() {
                                    return jQuery( "#ivru-txt-date" ).val();
                                }
                            }
                        }
                    },
                    userfile: {
                        required: true,
                        extension: "doc,docx,xls,xlsx,pdf"
                    }
                },
                messages: {
                    userfile: {
                        extension: "Allowed extension types are: doc, docx, xls, xlsx, pdf."
                    }
                }
            });
        });

Is there anything I am missing? 我有什么想念的吗?

It works fine but I can't get the form submitted after the remote validation returns from the server. 它工作正常,但是从服务器返回远程验证后我无法提交表单。 If it works fine then it is not jQuery fault but PHP action in your form. 如果工作正常,则不是jQuery错误,而是表单中的PHP操作。

And it shouldn't be like this: 它不应该是这样的:

url: "admin-ajax.php"

on place of 代替

url: '<?php echo admin_url('admin-ajax.php'); ?>'

http://jqueryvalidation.org/remote-method http://jqueryvalidation.org/remote-method

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM