[eluser]Fabdrol[/eluser]
[quote author="noctrum" date="1295986631"]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;
}
[/quote]
That way false is returned every time, since return result; will be called before result can be set to true by $.post.
You should move whatever you want to do with result to within the callback function!