js:
 function verificaExistPed(numped){
        var valida;
        jQuery.post("procedures/class_oc.php", // ajax post
            {
                cache      : false,
                checkYear  : true,
                numped     : numped
            },
            function(data)
            {
                if(data === "s"){
                    valida = true;
                }else{
                    valida = false;
                }
            }
        )
        return valida;
  }
and, calling the function in another place, should return valida result inside variable check, in my case, true or false.
var check = verificaExistPed('".$numped."');
alert(check); // always undifined
but, always undefined.
how can i set valida to true or false from a $.post callback ? 
 
     
     
    