title: Get Current Session Value in JavaScript?
body: <p>I have a scenario where I open my web application in a browser but in two separate tabs.</p>
  
  <p>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).</p>
  
  <p>My idea is to check the session on jQuery and if the session is null make the application logout,otherwise show a popup page..</p>
  
  <p>Here's my code for getting the session value</p>
  
  <pre><code>$(".a".click(function(){
     var session=var data = '@Session["UserName"]';
     if(session!=null){
      //Show popup
     }
     else{
      //Show loginpage
     }
  
  }))
  </code></pre>
  
  <p>How can I get the current session value in jQuery?</p>