jQuery中的会话处理 [英] session handling in jquery
问题描述
我正在使用以下代码将值存储在jQuery的会话对象中,但出现错误$ .session函数不是函数.
I am using following code to store value in session object in jQuery but i get error $.session function is not a function.
我还从githhub网站添加了插件"jquery.session.js",但是它不起作用.请让我帮忙解决问题
I also add plugin "jquery.session.js" from githhub site but it is not work. Pls let me help out what's wrong
// To Store
$(function() {
$.session("myVar", "value");
});
// To Read
$(function() {
alert( $.session("myVar") );
});
如果还有其他方法可以做到...然后也告诉我.....
If there is any other way to do this...then also tell me.....
推荐答案
假设您指的是该插件,您的代码应为:
Assuming you're referring to this plugin, your code should be:
// To Store
$(function() {
$.session.set("myVar", "value");
});
// To Read
$(function() {
alert($.session.get("myVar"));
});
在使用插件之前,请记住阅读其文档,以了解如何使用它.在这种情况下,可以在项目页面上显示的README.markdown
文件中找到一个用法示例.
Before using a plugin, remember to read its documentation in order to learn how to use it. In this case, an usage example can be found in the README.markdown
file, which is displayed on the project page.
这篇关于jQuery中的会话处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!