使用jquery保存会话var似乎不起作用
我在存储会话时遇到了麻烦……
我正在使用的代码:
//save to session $.session("compareLeftContent","value"); alert($.session("compareLeftContent"));
http://jsfiddle.net/dWsKJ/玩。
请问有什么想法?
在jsfiddle示例中,您提供的是没有附加会话插件。 $.session
不包含在jQuery中。 您需要使用此插件来实现此function: Jquery Session Plugin
然后使用$.session.set
和$.session.get
方法来存储和读取会话密钥。
例:
$.session.set("compareLeftContent","value"); alert($.session.get("compareLeftContent"));
你在使用session.js吗?
您需要使用$.session.set
设置会话:
$.session.set("compareLeftContent", "value");
要检索会话值,请使用$.session.get
:
alert($.session.get("compareLeftContent"));