I want to access the user data as global in whole website. I make a global array UserDataand push the user data at login time
$.getJSON(targetUrl,data,function(response) {
if(response.success){
UserData.push(response.userData);//push the user data in global variable
} else{
alert(response.error);
}
});//ajax request
It successfully pushes in array UserData. But when successful login redirects to welcome page. The data is not accessible on that page. It shows empty array.