function name_free(value, element){ //validation rule
var result;
if($('input[name="name"]').val() != value)
{
//console.log($('input[name="name"]').val());
$.post(CI.base_url + "admin_/info_psl/name_check_ajax", { pavadinimas: value}, function(data){
//console.log(data);
if(data == 'true')
result = true;
else result = false;
});
}
else result = true; //jei vienodi tai viskas ok
console.log(result);
return result;
}
when
if($('input[name="name"]').val() != value)
is true, then result variable is not set, it is undefined. How to assign a value for it in post callback funtion?