Hi there
Wondering if anyone can assist..
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..
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
$.getJSON('http://localhost:8500/mxRestore/model/mdl_user.cfc?method=getUserData&returnFormat=json&queryformat=column', {}, function(data){
var isLoggedIn = data.ROWCOUNT;
})
if (loggedIn > 0) {
// Do this
}
else {
alert('You are not logged in');
}
}
However, I am getting an error message saying the isLoggedIn variable isnt defined. Wondering how best to deal with this.
Thanks