javascript - Mootools code for success, failure and submit -
does mootools validation have similar process
success
, failure
, 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 fields red marks"); } });
i able send form without going next page, , run script on success
, on failure
.
you can add event functions mootools form request.
try this:
new form.request(myform, myresult, { onsend: function () { // function run on send alert('will send now!'); }, onfailure: function (){//function run if failure (fires after oncomplete) alert('oops...!'); }, oncomplete: function () {//function run on send complete alert('submited!'); }, onsuccess: function () {//function run on success alert('success!'); }, requestoptions: { //etc...
demo here
worth read:
- mootools blog on form request
- mootools docs (form.request)
Comments
Post a Comment