I'm trying to do a jquery remote validation on a 'Name' text field.
The validation checks if the name is unique, hence it has to be done
through the remote method.

'Save' button onclick is attached to this javascript method

function validateName() {
    txtName.rules('add', {
        remote: {
            url: 'validate.ashx'
            , data: ({id: txtName.attr('name')})
            }
        }
        , messages: {
            remote: '* Error'
        }
    });
    var isNameValid = txtName.valid()
    return isNameValid;
}

The problem I have is that .valid() always returns false - because it
doesn't wait for the remote validation GET to complete. Hence
validation fails. Any suggestions? How do people normally do remote
validation in jquery?

Note: I know for sure that validate.ashx returns true.

Thanks in advance.

Reply via email to