session handling in jquery

前端 未结 2 2008
孤城傲影
孤城傲影 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:32

    In my opinion you should not load and use plugins you don't have to. This particular jQuery plugin doesn't give you anything since directly using the JavaScript sessionStorage object is exactly the same level of complexity. Nor, does the plugin provide some easier way to interact with other jQuery functionality. In addition the practice of using a plugin discourages a deep understanding of how something works. sessionStorage should be used only if its understood. If its understood, then using the jQuery plugin is actually MORE effort.

    Consider using sessionStorage directly: https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Storage#sessionStorage

提交回复
热议问题