A little bit of context:
I'm using the jQuery Validation plugin to validate a sign-up form. I now want to implement an ajax call to check whether the user name is available in the system, and I want to make this ajax call only if the userName value is a valid one as per the rules set in $(form).validate();
I want something like:
$("#userName").keyup(function () {
if ($("#userName").isValid()) {
//make ajax called
}
});
I searched the documentation but i couldn't identify the solution to my problem.
-
Like this. I've never cared about the timing of my validators, so I don't know if putting the remote call last, as shown in both the examples, causes it to fire last. If not, make your other validations have a name which sorts alphabetically later than the remote validation.
Note that any can be made dependent upon the result of a function. Put the function after the validation name instead of "true."
0 comments:
Post a Comment