如何使用jquery在会话中保存单击的值 [英] How to save clicked value in session using jquery
本文介绍了如何使用jquery在会话中保存单击的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我点击树视图节点时,我会通过提醒来获取ID
$(' 。treeview a')。on(' 点击',功能(){
alert( this 。 id);
});
我尝试过:
但是如何保存那个id会话,我想在控制器中使用
i试过这个
$(' 。treeview a')。on(' 点击, function (){
@Session [ id] = 此 .id;
});
但是没有得到价值
决方案
(' 。treeview a')。on(' 点击, function (){
alert( this .id);
});
我尝试过:
但是如何保存那个id会话,我想在控制器中使用
i试过这个
(' 。treeview a')。on(' 点击', function (){
@Session [ id] = this .id;
});
但是没有得到价值
请尝试这样我创建创建cookie的函数。
function deleteCookie(key){
document .cookie = key + ' =; expires = Thu,1970年1月1日00:00: 01 GMT;';
};
function setCookie(key,value){
var expires = new Date ();
expires.setTime(expires.getTime()+( 60 * 1000 ));
document .cookie = key + ' = ' + value + ' ; expires =' + expires.toUTCString();
}
在点击功能中设置cookie。
when i click tree view node am getting id by giving alert
$('.treeview a').on('click', function () { alert(this.id); });
What I have tried:
but how to save that id session , i want to use in controller
i have tried this
$('.treeview a').on('click', function () { @Session["id"]=this.id; });
but am not getting value解决方案('.treeview a').on('click', function () { alert(this.id); });
What I have tried:
but how to save that id session , i want to use in controller
i have tried this
('.treeview a').on('click', function () { @Session["id"]=this.id; });
but am not getting value
Please try like this I created function that create cookie.
function deleteCookie(key) { document.cookie = key + '="";expires=Thu, 01 Jan 1970 00:00:01 GMT;'; }; function setCookie(key, value) { var expires = new Date(); expires.setTime(expires.getTime() + (60 * 1000)); document.cookie = key + '=' + value + ';expires=' + expires.toUTCString(); }
set cookie in click function.
这篇关于如何使用jquery在会话中保存单击的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文