remember login state, and check if user is logged in on page
This commit is contained in:
2
wwwroot/js/profile.js
Normal file
2
wwwroot/js/profile.js
Normal file
@ -0,0 +1,2 @@
|
||||
$(document).ready(function() {
|
||||
});
|
@ -1,3 +1,20 @@
|
||||
$(document).ready(function() {
|
||||
console.log("hey from js");
|
||||
//check login state
|
||||
console.log("page loaded");
|
||||
$.post('/senddata/checkloginstate','action=getloginstate',function(data){
|
||||
console.log(data);
|
||||
if (data.loggedin == true) {
|
||||
$("#userlabel").html(" "+data.username);
|
||||
}else{
|
||||
$("#userlabel").html(" not logged in!!");
|
||||
}
|
||||
},'json');
|
||||
|
||||
|
||||
|
||||
$('#logoutbtn').click(function() {
|
||||
$.post('/senddata/checkloginstate','action=logout',function(data){
|
||||
console.log(data);
|
||||
},'json');
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user