On the submit button click, I am calling an API. And if it returns true, i want to show error message and stop submitting form.
But if it returns false, I want to submit the form.

jquery code:

```
  $(document).ready(function () {
    $('#submit').click(function () {
        if ($('#EMail').val().length != 0) {

            var email = $('#EMail').val();
            var url = "url";
            $.ajax({
                type: "GET",
                url: url,
                dataType: "xml",
                success: function (responsedata) {
                    var result = $(responsedata).find("Exists").text();
                    console.log(result);
                    if (result == 'false') {
                        $('#frmsignup').submit();

                    } else {
                        //show error.
                        return false;
                    }
                },
                complete: function () {

                },
                error: function () {

                }
            });

        } else {
            $('#frmsignup').submit();
        }
    });
});

```

but the problem is with the above code even `if (result == 'true')`, the form gets submitted and error doesn't show up.
What am I doing wrong?