I am trying to use jquery validation to validate some input values on the form. On one of the form I have to make a remote call to the server to check if the required entered value is valid or not. So I have something like:
$("#myform").validate({
rules: {
zip: {
required: true,
zip: true,
remote: "check-zip.action"
}
}
});
Now for some very unusual testing scenario - I need to handle the validation, when a server does not respond to the remote call. I see through a javascript plugin (google pagespeed)... that the remote call to the server for validation keeps on hanging out... even if the server is down. I am having hard time figuring out if there is a timeout or something I could use so that after trying to connect for desirable number of seconds.. I could call out a javascript function to display the user that ... the server was unavailable to validate the zip code.. or some other meaningful message. i tried adding timeout:10000, but did not work.. Any help is greatly appreciated.
Thanks