[jQuery] form validation w/ simple ajax

[jQuery] form validation w/ simple ajax


Hey all,
I am working on some form validation and all works fine except on point.
what I am trying to do is check if an email address is already in the
database, I get the connection and the function gets a return but I can't
get the return to return true.
Not sure if this making sense so here is the code.
function isAjaxCheckEmail(str){
    try{
        var args;
        if(isCD){ // this is a variable that is set to true if the site is on a cd
            return false;
        }
        else{
// this is my post to an asp page, below this code is what is being returned
                $.post('ajax.asp', { value: str }, function(json) {
                        eval("var args = " + json);
                        if (args.success == "true"){
                         alert('true');
                         return true;
                        }
                        else
                        {
                             alert('false');
                             return false;
                        }
                     });
        }
    }
    catch(e){}
}
the alerts execute, but the returns don't.
returned from ajax.asp
"{""success"": ""true"", ""msg"": ""all good"}"
any direction would be greatly appreciated.
--
View this message in context: http://www.nabble.com/form-validation-w--simple-ajax-tf2554683.html#a7118654
Sent from the JQuery mailing list archive at Nabble.com.
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/