Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

happy function get's called on Ajax Call #82

Open
awaistariq opened this issue Sep 16, 2018 · 0 comments
Open

happy function get's called on Ajax Call #82

awaistariq opened this issue Sep 16, 2018 · 0 comments

Comments

@awaistariq
Copy link

How can I prevent form submission on ajax call?
As soon as I make an ajax call to get some data from server, my form gets submitted. How to prevent this?
Code is as follows:
` unHappy: function (values) {

        if ($('#home').find('span.unhappyMessage').length !== 0) {
            $('.one').css('background-color', 'red');
        } else {
            $('.one').css('background-color', 'white');
        }
        if ($('#mother').find('span.unhappyMessage').length !== 0) {
            $('.two').css('background-color', 'red');
        } else {
            $('.two').css('background-color', 'white');
        }
        if ($('#father').find('span.unhappyMessage').length !== 0) {
            $('.three').css('background-color', 'red');
        } else {
            $('.three').css('background-color', 'white');
        }
        if ($('#officer').find('span.unhappyMessage').length !== 0) {
            $('.four').css('background-color', 'red');
        } else {
            $('.four').css('background-color', 'white');
        }
        if ($('#informant').find('span.unhappyMessage').length !== 0) {
            $('.five').css('background-color', 'red');
        } else {
            $('.five').css('background-color', 'white');
        }
    },
    happy: function (values) {

        $('.one').css('background-color', 'white');
        $('.two').css('background-color', 'white');
        $('.three').css('background-color', 'white');
        $('.four').css('background-color', 'white');
        $('.five').css('background-color', 'white');
    },

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant