how to know if someone is logged via javascript?

前端 未结 4 1384
渐次进展
渐次进展 2021-01-03 08:43

in php i would do

if (isset($_COOKIE[\'user\']) && $_COOKIE[\'user\'] == $valueFromDb)
 echo \'logged\';

But in javascript how can

4条回答
  •  死守一世寂寞
    2021-01-03 09:34

    Yes. check out this question: Create, read, and erase cookies with jQuery

    a plugin to make it even easier for you: http://plugins.jquery.com/project/cookie

提交回复
热议问题