So here is my code:
$.ajax({
url: "src/logcheck.php",
type: "POST",
dataType: "JSON",
async: true,
data: {cookie: logCookieHashed},
success: function(json){
loggedUser = json.user;
alert(loggedUser);
}
});
delay(500);
alert(loggedUser);
When I call "alert(loggedUser)" for first time the output is correct, but when I call it for second time it outputs empty string, loggedUser is global variable.