I have a scenario where I open my web application in a browser but in two separate tabs.
In one tab I signed out from the application and as a result the all session values becomes null. While in the other tab I clicked on an anchor tag in the webapplication. In the anchor tag's jquery-on click event I have checked the session value. Here I am supposed to get the session as null(since I logged out the application from the other tab), but I am getting session value as logged in user(probably because no page refresh occurs).
My idea is to check the session on jQuery and if the session is null make the application logout,otherwise show a popup page..
Here's my code for getting the session value
$(".a".click(function(){
var session=var data = '@Session["UserName"]';
if(session!=null){
//Show popup
}
else{
//Show loginpage
}
}))
How can I get the current session value in jQuery?
question from:
https://stackoverflow.com/questions/23538834/get-current-session-value-in-javascript 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…