Dan G. Switzer, II schrieb:
> Gareth,
>
> In order to get this to work the way you have it, you'd have to do a
> "synchronous" call to the server, which wouldn't be AJAX (the "A" is for
> asynchronous.) :)
>
> Because the code you have is running asynchronously, the AJAX call is fired
> off and then the validation routine continues on its way. However, when the
> server responds back, your callback function runs--which displays the alert.
>
> You should be able to do a synchronous call using the $.ajax() function, but
> it's pretty much always a bad idea to rely on synchronous operations (since
> if something happens during the transmission--it can really cause problems.)
>
> For asynchronous validation, I'd recommend doing those as a separate remote
> call and then have once the validation returns, have it fire off the rest of
> the local validation. You could build a queuing of remote validation rules
> that get fired off and once all the rules have returned, run the local
> validation.
>
> Just be aware that AJAX validation can really cause UI issues if the server
> is unresponsive.
>   
Hardly anything to add, thanks Dan, once again.

I still want to enable client-side validation on submit and keyup and 
ajax validation on blur without to much effort on the clients side (the 
user of the plugin).

So far you have to manully trigger the ajax validation, and then use the 
validator object (returned by the validate method) to display error 
messages via the showErrors() method ( 
http://jquery.bassistance.de/api-browser/plugins.html#jQueryvalidatorprotoypeshowErrorsMap
 
).

-- 
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to