简体   繁体   中英

Can't get jStorage to pull user object - keeps saying “user is null”

I can't get jStorage to work. When I test it with the following code the result is "user is null" How do I get user to return the proper value and also target its attributes that exist in the mySql database.

var user = $.jStorage.get('user');
console.log('user is ' + user);

Did you set user before get it? try something like this

var user = $.jStorage.get("user");
if(!user){
        user = 'SomeUser';
    $.jStorage.set("user",value);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM