Replies: 2 comments
-
Antlers is parsed before the browser receives the HTML for the page so any code you have there won't be dependent what happens within your JavaScript. |
Beta Was this translation helpful? Give feedback.
0 replies
-
You cannot set session data from javascript. If you want to set session data from js, you'll need to do an ajax request to somewhere on the server and set it within php. You can set cookies from JS, though. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm using AlpineJS to have a quiz on my page, when someone completes the quiz I would like to set the score in the session, so I can send it along a form deeper down the page.
I can use
{{ session:set score="10" }}
to set the score, but when I add this to a function in JS, it is executed immediately, the code is parsed by antlers even if the JS function is not ran.Does anyone know if I can set Statamic session data from within JS?
Beta Was this translation helpful? Give feedback.
All reactions