存储在会话或cookie中 [英] store in session or cookie
问题描述
如何存储母版页的标签值,以便我可以从jquery .do访问任何其他页面。我需要使用会话或cookie或类似的东西,以便在重定向到其他页面时不会丢失
这是我的代码
< pre lang =cs> $( 。left_bt)。click(function(){
var prodDetailID = $( [id * = lblProductID],$( this )。nearest( < span class =code-string> div))。html();
var keyName = $( [id * = lblKeyName],$( this ) .closest( div))。html();
var eshopPrice = $( [id * = lblEShopPrice],$( this )。nearest( 。DIV跨度>))的HTML();
// var ProductDetails =(+ prodDetailID +)+ keyName + /+ eshopPrice;
var ProductDetails = < span class =code-string>( + prodDetailID + ) + keyName + \\\\ n;
var InitialValue = $( [id * = lblShopProdID])。text()+ \\\\ n;
var EshopTotalAmount;
if (InitialValue == No Product选择){
$( [id * = lblShopProdID] ).text(ProductDetails)+ \\\\ n;
alert( 产品详细信息: + ProductDetails + 成功添加到购物车);
}
else
{
var newInitialValue = $( [id * = lblShopProdID])。text()+ \\\\ n ;;
$( [id * = lblShopProdID])。text(newInitialValue + \\\\ n + ProductDetails);
alert( 产品详细信息: + ProductDetails + 成功添加到购物车);
}
});
这里lblshopprodid是标签,其中包含用户点击的项目,但每次我移动到其他页面时丢失的情况应该不是这样的。我怎么能避免这种情况请提前帮助谢谢
( 。left_bt)。click(function(){
var prodDetailID =
( [id * = lblProductID],
( this )。nearest( div ))。html();
var keyName =
How can i store the label value of masterpage so that i can access from any other page from jquery .do i need to use session or cookie or something like that so that it is not lost when redirected to other pages
here is my code
$(".left_bt").click(function () {
var prodDetailID = $("[id*=lblProductID]", $(this).closest("div")).html();
var keyName = $("[id*=lblKeyName]", $(this).closest("div")).html();
var eshopPrice = $("[id*=lblEShopPrice]", $(this).closest("div")).html();
//var ProductDetails = "("+ prodDetailID +")" + keyName + "/" + eshopPrice;
var ProductDetails = "(" + prodDetailID + ")" + keyName +"\r\n" ;
var InitialValue = $("[id*=lblShopProdID]").text()+"\r\n";
var EshopTotalAmount;
if (InitialValue == "No Product Selected") {
$("[id*=lblShopProdID]").text(ProductDetails)+"\r\n";
alert("Product Detailed: " + ProductDetails + " added successfully to cart");
}
else
{
var newInitialValue = $("[id*=lblShopProdID]").text() + "\r\n";;
$("[id*=lblShopProdID]").text(newInitialValue + "\r\n" + ProductDetails);
alert("Product Detailed: " + ProductDetails + " added successfully to cart");
}
});
here lblshopprodid is the lable which has items that user has clicked but everytime i move to other pages it gets lost which should not be the case. how can i avoid this please help thanks in advance
(".left_bt").click(function () { var prodDetailID =
("[id*=lblProductID]",
(this).closest("div")).html(); var keyName =
这篇关于存储在会话或cookie中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!