I have a custom verifier that is written using the jquery plugin, to verify the input using the database A php page calls to the server. I do not know how to do this, but it's best, as I am not a JavaScript / AJAX programmer
jQuery.validator.addMethod ('checkVehicleRegistration', function (Val, element) ) {Var x = $ .ajax ({type: "POST", async: false, url: "Ajax / Verification / CheckVehal Registry .php", Data: "vehicle_reg =" + val, success: work {resp} {} , Error: Function (E) {Warning ('CheckVellon Registration Fail');}}); if (x.responseText == '0') {Back true;} and {return false;}}, registration already is present '); This is not the best code in the world because I have to make Ajax call synchronous, which defeats the object of all though, as I am not a JavaScript programmer, it is a The miracle that works perfectly.
My problem is that verification is really slow Jquery appears to call this recognition function several times. I have come to know when verification work is done, and when you have to type in the text box, when you exit the text box and whenever you submit the form, verification is sometimes called, the address Have tried to use alerts to apply.
How can I set up this custom verification function so that it is called only when users submit the press and not when they typing / tabbing in the text box? Apart from this, the 'design pattern' for any suggestion has been suggested how I should have done better by using this server-side verification by Ajax is very much appreciated
Thank you very much
Thanks
You do not need to create your own method, for example, remote The method is the method of doing everything you do, e-mail address, and already exist or check some things Along with, this passes through usernames by mail:
$ ("#myform"). Validity ({Rule: {email: {required} true, email: correct, remote: {url: "check-email.php", type: "post", data: {username: function () {return $ (" # Username ") .val ();}}}}}, Message: {email: {remote:" Type your message here "}}}); In addition, you can disable some events, so it will be faster, for example, when you submit the form, it will only check the verification:
$ ("#myform"). Validate ({onfocusout: incorrect, onkeyup: false, onclick: false, rule: {}});
No comments:
Post a Comment