How deep in the scope can you go in nested functions and still return
a value? For example:

$.validator.addMethod('userCheck', function (value) {
    $.ajax({
        type: "POST",
        url: "_scripts/send_message.php",
        data: "action=checkuser& username=" + value,
        success: function(msg) {
            if (msg) {
                return false;
            }
            else {
                return true;
            }
        }
    });
},"");

Why isĀ“nt this working?

If i do this:

//Global
var result;

$.validator.addMethod('userCheck', function (value) {
    $.ajax({
        type: "POST",
        url: "_scripts/send_message.php",
        data: "action=checkuser& username=" + value,
        success: function(msg) {
            if (msg) {
                result = false;
            }
            else {
                result = true;
            }
        }
    });

},"");

I get the value back but it does not work properly,

Reply via email to