why the javascript variable doesn't change among function?
<p>my problem with the following javascript function:</p>

<pre><code>function ValidateDates() {

var valid = false;
birthD = $("#cp1_txtBirthDate").val();
initialD = $("#cp1_txtInitialDate").val();
var regexp = new RegExp("^([1-9]|(0|1|2)[0-9]|30)(/)([1-9]|1[0-2]|0[1-9])(/)((20|19|18)[0-9]{2})$");

if (birthD != "__/__/____" &amp;&amp; initialD != "__/__/____") {
    if (regexp.test(initialD) &amp;&amp; regexp.test(birthD)) {

        $.get("ValidateDates.aspx?BirthD=" + birthD + "&amp;InitialD=" + initialD, function (data) {
            if (data == 0) {
                valid = true;

                $("#Dates_span").html("");
            }

            else {
                $("#Dates_span").html("*" + data);
                valid = false;

            }

        });

    }
}

return valid;
}
</code></pre>

<p>here when i check the variable valid i found it "false" even if its true, because the initial for it is false from the beginning of function so how to solve it and what is wrong?</p>
