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;
            }
        }
    });
    return result;
},"");

i get the value back but it does not work properly, It gets the value
from the textfield but on keyup it's always one letter short... so i
have to type one more letter to get the right value. I´m stuck on this
so any help would be greatly appreciated! :)

Thanks in advance

George

Reply via email to