ZSH
ZSH

Reputation: 661

Authenticate by jQuery validation

I use jQuery validation. I check data in submitHandler.

I read this answer it's very good but I want authenticate when form is valid and I want do it by jQuery validation not jquery.ajax is there a solution?

 $("#signupForm").validate({
            rules: {
                username: "required",
                password: "required",
            },
            messages: {
                username: "required",
                password: "required",
            },
            submitHandler: function () {
                $.ajax
                    ({
                        type: "POST",
                        url: "authenticate.ashx",
                        dataType: 'json',
                        async: false,
                        data: '{"userName": "' + userName + '", "password" : "' + password + '"}',
                        success: function () {
                        }
                    });
            }

Upvotes: 0

Views: 126

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

jQuery validation is a plugin for validating form controls in the client side, it is not responsible for server side communications like submitting data to server.

You will need to use ajax to do it as you have done.

Upvotes: 2

Related Questions