Jquery and jQuery-Validation-Engine

偶尔善良 提交于 2020-01-06 03:24:46

问题


I am using jQuery-Validation-Engine found at GitHub and it is working good, but I can't manage one thing ,after form is submitted to create action. Code so far:

jQuery(document).ready(function(){
            jQuery("#contact-form").validationEngine({
ajaxFormValidation: true,
             onSuccess: function(){
                 alert(1);
             }
            });
        });

This is working(data is written into db) but there is no alert. I also tried with onAjaxFormComplete but again nothing. Does someone have experience with this plugin?


回答1:


Could you try this:

jQuery(document).ready(function(){
            jQuery("#contact-form").validationEngine('attach', {
                ajaxFormValidation: true,
                onAjaxFormComplete: function(form, status){
                    alert("The form status is: " +status);
                }  
            });
        });

Also remember than on the SUBMIT page(where you send it to the database), you need to gerenate a repsonse back -if the form was submitted or not (true/false).

See: https://github.com/posabsolute/jQuery-Validation-Engine/blob/master/demos/phpajax/ajaxValidateSubmit.php



来源:https://stackoverflow.com/questions/7428229/jquery-and-jquery-validation-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!