Return to Snippet

Revision: 23778
at February 12, 2010 15:50 by almazom


Updated Code
<html>
<head>
<script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>      
<script type="text/javascript" src="js/jquery.json-2.2.js"></script>
<script type="text/javascript" src="js/jquery.extjasoncookie-0.2.js"></script>      
<script>
function onl(){
	save2basket(1,1000,8);
	var getByid = getFromBasket(1);
	alert(getByid.price) // trace price
	alert(getByid.quantity) // trace q

	save2basket(1,1200,3); //change quantity or price

} 


function getFromBasket(id){
	  var id = 'id'+String(id);
	  return  jQuery.extendedjsoncookie("getCookieVariable",id, "options"); 
}

function save2basket(id,Price,Quantity){
	 var id = 'id'+String(id);
	 var Price = String(Price);
	 var Quantity = String(Quantity);
	 jQuery.extendedjsoncookie("removeCookie",id); 
	 
	 var opt = {price : Price,quantity : Quantity}; 
	 jQuery.extendedjsoncookie("setCookieVariable",id, "options", opt ); 
}

function removeFromBasket(id){
	var id = 'id'+String(id);
	jQuery.extendedjsoncookie("removeCookie",id); 
}
</script>
</head>
<body onload='onl()'>
</body>
</html>

Revision: 23777
at February 12, 2010 15:46 by almazom


Updated Code
<html>
<head>
<script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>      
<script type="text/javascript" src="js/jquery.json-2.2.js"></script>
<script type="text/javascript" src="js/jquery.extjasoncookie-0.2.js"></script>      
<script>
function onl(){
	save2basket(1,1000,8);
	var getByid = getFromBasket(1);
	alert(getByid.price) // trace price
	alert(getByid.quantity) // trace q

	save2basket(1,1200,3); //change quantity or price

} 


function getFromBasket(id){
	  var id = 'id'+String(id);
	  return  jQuery.extendedjsoncookie("getCookieVariable",id, "options"); 
}

function save2basket(id,Price,Quantity){
	 var id = 'id'+String(id);
	 var Price = String(Price);
	 var Quantity = String(Quantity);
	 jQuery.extendedjsoncookie("removeCookie",id); 
	 
	 var opt = {price : Price,quantity : Quantity}; 
	 jQuery.extendedjsoncookie("setCookieVariable",id, "options", opt ); 
} 
</script>
</head>
<body onload='onl()'>
</body>
</html>

Revision: 23776
at February 12, 2010 15:45 by almazom


Updated Code
<html>
<head>
<script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>      
<script type="text/javascript" src="js/jquery.json-2.2.js"></script>
<script type="text/javascript" src="js/jquery.extjasoncookie-0.2.js"></script>      
<script>
function onl(){
	save2basket(1,1000,8);
	var getByid = getFromBasket(1);
	alert(getByid.price) // trace price
	alert(getByid.quantity) // trace q

	save2basket(1,1200,3); //change quantity or price

} 


function getFromBasket(id){
		var id = 'id'+String(id);
	  return  jQuery.extendedjsoncookie("getCookieVariable",id, "options"); 
}

function save2basket(id,Price,Quantity){
	 var id = 'id'+String(id);
	 var Price = String(Price);
	 var Quantity = String(Quantity);
	 jQuery.extendedjsoncookie("removeCookie",id); 
	 
	 var opt = {price : Price,quantity : Quantity}; 
	 jQuery.extendedjsoncookie("setCookieVariable",id, "options", opt ); 
} 
</script>
</head>
<body onload='onl()'>
</body>
</html>

Revision: 23775
at February 12, 2010 15:44 by almazom


Updated Code
<html>
<head>
	
<script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>      
<script type="text/javascript" src="js/jquery.json-2.2.js"></script>
<script type="text/javascript" src="js/jquery.extjasoncookie-0.2.js"></script>      
<script>
function onl(){
	save2basket(1,1000,8);
	var getByid = getFromBasket(1);
	alert(getByid.price) // trace price
	alert(getByid.quantity) // trace q

	save2basket(1,1200,3); //change quantity or price

} 


function getFromBasket(id){
		var id = 'id'+String(id);
	  return  jQuery.extendedjsoncookie("getCookieVariable",id, "options"); 
}

function save2basket(id,Price,Quantity){
	 var id = 'id'+String(id);
	 var Price = String(Price);
	 var Quantity = String(Quantity);
	 jQuery.extendedjsoncookie("removeCookie",id); 
	 
	 var opt = {price : Price,quantity : Quantity}; 
	 jQuery.extendedjsoncookie("setCookieVariable",id, "options", opt ); 
} 
</script>
</head>
<body onload='onl()'>
</body>
</html>

Revision: 23774
at February 12, 2010 15:40 by almazom


Initial Code
<html>
<head>
	
<script type="text/javascript" src="js/jquery-1.4.1.min.js"></script>      
<script type="text/javascript" src="js/jquery.json-2.2.js"></script>
<script type="text/javascript" src="js/jquery.extjasoncookie-0.2.js"></script>      
<script>
function onl(){
	save2basket(1,1000,8);
	var getByid = getFromBasket(1);
	alert(getByid.price) // trace price
	alert(getByid.quantity) // trace q

	save2basket(1,1200,3); //change quantity or price

} 


function getFromBasket(id){
		var id = 'id'+String(id);
	  return  jQuery.extendedjsoncookie( "getCookieVariable",id, "options"); 
}

function save2basket(id,Price,Quantity){
	 var id = 'id'+String(id);
	 var Price = String(Price);
	 var Quantity = String(Quantity);
	 jQuery.extendedjsoncookie("removeCookie",id); 
	 
	 var opt = {price : Price,quantity : Quantity}; 
	 jQuery.extendedjsoncookie( "setCookieVariable",id, "options", opt ); 
} 
</script>
</head>
<body onload='onl()'>
</body>
</html>

Initial URL


Initial Description
link to plugin http://projects.exvoto.org/jquery-extjsoncookie/

Initial Title
make e-commerce basket, using cookie

Initial Tags
javascript, jquery

Initial Language
jQuery