• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] don't understand javascript variable scope; now talking about validation plugin

#3
[eluser]danmontgomery[/eluser]
move the result declaration outside of the function.

Code:
var result = false;
function name_free(value, element) {
    if(something) {
        $.post('something', { foo: bar }, function(data) {
            if(data == 'true') result = true;
        }
    }
    console.log(result);
    return result;
}


Messages In This Thread
[solved] don't understand javascript variable scope; now talking about validation plugin - by El Forum - 01-25-2011, 08:17 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.