title: Scala/Play how to update main.scala.html HTML to show/hide text
body: <p>I am new to Scala and Play and am using the main.scala.html page -- which in my understanding, is used as a Single Page Application (SPA) framework.  I hope this is a correct statement.</p>
  
  <p>I am attempting to switch a link/text from Login to Logout, based on a session variable that is set with the application.  For some reason, the main.scala.html page will not recognize this variable, even though it has changed.</p>
  
  <p>Here is the main.scala.html code excerpts:</p>
  
  <pre><code>@(user: User = null, scripts: Html = Html(""), isLoggedIn: String = "")(content: Html)
  
  &lt;!DOCTYPE html&gt;
  
  &lt;html&gt;
      &lt;head&gt;
  ...
          &lt;script type="text/javascript"&gt;
              @isLoggedIn = isLoggedIn();
          &lt;/script&gt; 
      &lt;/head&gt;
      &lt;body&gt;
  ...
  &lt;div class="pull-right"&gt;
                          &lt;nav class="navmenu center"&gt;
                              &lt;ul&gt;
                                  &lt;li class="scroll_btn"&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;/li&gt;
                                  &lt;li class="scroll_btn"&gt;&lt;a href="/signup"&gt;Register&lt;/a&gt;&lt;/li&gt;
                                  @if(isLoggedIn == true) {
                                      &lt;li class="scroll_btn"&gt;&lt;a href="/logout"&gt;Logout&lt;/a&gt;&lt;/li&gt;
                                  } else {
                                      &lt;li class="scroll_btn"&gt;&lt;a href="/auth"&gt;Login&lt;/a&gt;&lt;/li&gt;
                                  }
                              &lt;/ul&gt;
                          &lt;/nav&gt;
  &lt;/div&gt;
  ...
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the isLoggedIn() function:
  function isLoggedIn() {</p>
  
  <pre><code>var email = '&lt;%= Session["email"] %&gt;';
  if (email != null || email != "") {
  return true;
  }
  else {
   return false;
  }
  }
  </code></pre>
  
  <p>I know the email session variable is set -- it is not null, so the code should work.</p>
  
  <p>Is there some sort of "refresh" issue with the main.scala.html?  Or does Scala not function as a SPA framework?</p>
  
  <p>I appreciate any help.</p>
  
  <p>Thanks!
  Dan</p>