title: Laravel - check is user logged in with JavaScript
body: <p>Maybe is stupid question but is possible to check is user logged in with javascript...</p>
  
  <p>How to check is user logged in with JavaScript?</p>
  
  <p>I tried:</p>
  
  <pre><code>$(document).ready(function() {
      $('#facebook').click(function(){
          window.open(this.href, "myWindowName", "width=800, height=600");
          return false;
          setInterval(function() {
              @if {{Auth::check()}};
                  alert('loged')
              @else
                  alert('not loged')
              @endif
          }, 5000);
      });
  });
  </code></pre>
  
  <p>of course this doesn't work.</p>
  
  <p>So I need when I click on <code>#facebook</code> to check every 5 seconds if user is logged in.</p>