2

Does Mootools validation have a similar process for

Success, Failure and ajaxSubmitFile?

 $("#rems").validationEngine({
                    ajaxSubmit: true,
                    ajaxSubmitFile: "database/agentpanel/reminder/makerem.php",
                    success : function() { 
                        $.get("database/agentpanel/reminder/loadrem.php", function(html) {
                        $("#rem-scroll").html(html);
                        alert("Reminder Set");
                        $('#rems').find("input[type=text], textarea").val("");
                        $('#rem_confirm').attr('checked', false);
                        });
                    }, 
                    failure : function() { alert("Fill in all the fields with Red Marks"); }
                });

I would like to be able to send the form without going to the next page, and also run an script on success and on failure.

4

1 回答 1

1

您可以将事件函数添加到 Mootools表单请求

尝试这个:

new Form.Request(myForm, myResult, {      
    onSend: function () {  // function to run on send
        alert('Will send now!');
    },
    onFailure: function (){//function to run if failure (fires after onComplete)
        alert('oops...!');
    },
    onComplete: function () {//function to run on send complete
        alert('Submited!');
    }, 
    onSuccess: function () {//function to run on success
        alert('Success!');
    },
    requestOptions: { //etc...

演示在这里

值得一读:

于 2013-09-04T07:26:30.190 回答