This is my function:
function isLoggedIn(){
$newuid = uid;
alert("1");
if(uid == null){return false;}
$.getJSON("login.jsp",{uname: uname, upass : upass},function(data){
alert("2");
$newuid = data.uid;
});
alert("3");
return $newuid == uid;
}
It will alert 1 then 3 and then 2. Why is that and how can i fix it?