用jQuery保存会话变量似乎不起作用 [英] Saving session var with jquery doesn't seem to work

查看:63
本文介绍了用jQuery保存会话变量似乎不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法存储会话...

I'm having trouble storing session...

我正在使用的代码:

//save to session
    $.session("compareLeftContent","value");
    alert($.session("compareLeftContent"));

http://jsfiddle.net/dWsKJ/一起玩.

有什么想法吗?

推荐答案

在jsfiddle示例中,您提供了未附加的会话插件. $.session不包含在jQuery中.您需要使用此插件才能具有此功能: Jquery会话插件

On jsfiddle example you provided there is no session plugin attached. $.session is not included in jQuery. You need to use this plugin to have this functionality: Jquery Session Plugin

然后使用$.session.set$.session.get方法来存储和读取会话密钥.

Then use $.session.set and $.session.get methods to store and read session keys.

示例:

$.session.set("compareLeftContent","value");
alert($.session.get("compareLeftContent"));

这篇关于用jQuery保存会话变量似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆