0

Below is the format of jQuery function I am using. I need to exit from the entire js-validation function if condition 3 fails.

I have tried using return false and return, However the function is not getting exited , $.post in the subsequent part is getting executed.

Any help please?

$("body").on("click", ".js-validation", function(event) {
    if (condition 1) {
        /* doing something*/
    } else {
        if (condition 2) {
            $.get( "abc-json.php",{value:value} ).done(function(data) {
                if (condition 3) {
                    return;
                }
            }

            $.post();
        }
    });
Rory McCrossan
  • 331,213
  • 40
  • 305
  • 339
Wings2fly
  • 887
  • 1
  • 11
  • 31

0 Answers0