ASP.NET Async jQuery and SetIsValid
<p>I have this code to check email availability - in JS script file <br>
When i use <br>
(async: false) and cntr.SetIsValid(false); <br>
IsValid action doesn't apply on cntr <br>
but If i use <br>
(async: true) and cntr.SetIsValid(false); <br>
IsValid action apply succesfully on cntr <br>
Why ?</p>

<p>I want to use async: false with cntr.SetIsValid</p>

<pre><code>function OnEmailValidation(s, e) {
var illegalChars = /^\w+([-+.'''']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
var spanEmail = document.getElementById("spanEmail");

var obj = GetObj('txt_Email');
var cntr = aspxGetControlCollection().Get(obj.id);

if (!illegalChars.test(e.value)) { 
    spanEmail.innerHTML = "Invalid Email";
    spanEmail.style.color = "red";

    cntr.SetIsValid(false);

} else {
    $.ajax({
        type: "POST",
        async: false,
        url: "myweb_service.asmx/CheckEmail",
        data: "{'email':'" + e.value.toString() + "'}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(res) {
            if (res.d == "true") {
                spanEmail.innerHTML = "Email register before";
                spanEmail.style.color = "red";

                cntr.SetIsValid(false);
            }
            if (res.d == "false") {
                spanEmail.innerHTML = "Available";
                spanEmail.style.color = "#76EB69";

                cntr.SetIsValid(true);
            }
        }
    });
}}
</code></pre>
