Expand my Community achievements bar.

SOLVED

Unable to Retrieve Values from Context Variable

Avatar

Level 1

Hi Team ,script.pngHTML 1.png
I have an array on my website that will hold several values when a user clicks the "add to cart" button. I have also created a context variable to set the values from the array, but during execution, I was unable to obtain the values from the context variable

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @sarjoon 

 

Try changing setValue code to this:

document.controller.setValue("/ctx/vars/cartData",cartItems);

console.log(document.controller.getValue("/ctx/vars/cartData"))

 


     Manoj
     Find me on LinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hello @sarjoon 

 

Try changing setValue code to this:

document.controller.setValue("/ctx/vars/cartData",cartItems);

console.log(document.controller.getValue("/ctx/vars/cartData"))

 


     Manoj
     Find me on LinkedIn

Avatar

Administrator

Hi @sarjoon,

Were you able to resolve this query on your own or do you still need help here? Do let us know.

Thanks!



Sukrity Wadhwa