I try to get some info from external php with ajax and use the data but my global var return undefined.I try with async false but is deprecated.If i console in success function it has value outside is undefined.
var pkz;
$(function(){
$.ajax({
type:'GET',
url: '/user/cred',
success: function (data){
pkz=data;
}
});
console.log(pkz);