title: Check user is logged in using Jquery
body: <p>Wondering if anyone can assist..</p>
  
  <p>I am adding some jquery to my site, but I want to restrict some actions dependant on whether a user is logged in or not. I am unsure of how to detect the session variable with Jquery..</p>
  
  <p>My initial thought was to call my checkUser cfc using Jquery Ajax and then check how many rows where returned from this, and work from there. But am unsure of how to tackle this. At the moment, my code looks like this</p>
  
  <pre><code>$.getJSON('http://localhost:8500/mxRestore/model/mdl_user.cfc?method=getUserData&amp;returnFormat=json&amp;queryformat=column', {}, function(data){
      var isLoggedIn = data.ROWCOUNT;
  })
  
  if (loggedIn &gt; 0) { 
    // Do this
  } 
  else {
    alert('You are not logged in');
  }
  }
  </code></pre>
  
  <p>However, I am getting an error message saying the isLoggedIn variable isnt defined. Wondering how best to deal with this.</p>
  
  <p>Thanks</p>