session handling in jquery

前端 未结 2 2025
孤城傲影
孤城傲影 2020-12-20 13:46

I am using following code to store value in session object in jQuery but i get error $.session function is not a function.

I also add plugin \"jquery.session.js\" fr

2条回答
  •  臣服心动
    2020-12-20 14:23

    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"));
    });
    

    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.

提交回复
热议问题