How to access html5 data store values from liquid block?

176 views
Skip to first unread message

liquid1234

unread,
Mar 12, 2012, 4:19:25 PM3/12/12
to liquid-t...@googlegroups.com
In my website, i am storing couple of user input values in html5 data store through JS. I don't know how to transfer the value from html5 data store to liquid so that i can use it my custom block.

Example:

1) Let's say, user enters valid city and state in a textbox and i store those two values in html5 data store (i need access to those values in other pages of my website)
  • <script type="text/javascript">
  • localStorage.city = "<city>";
  • localStorage.state = "<state>";
  • </script>
2) Now i have to use those values in my custom liquid block to get location specific results. How do i do that?
  • <script type="text/javascript">
  • {% customblock city:<city> state:<state> %}
  • {% endcustomblock %}
  • </script>

John Maxwell

unread,
Mar 28, 2012, 9:45:15 AM3/28/12
to liquid-t...@googlegroups.com
You can't do that with liquid - you're mixing up a Server-side technology with a Client-side one. You would need to use Javascript to retrieve the value you stored and set a DOM element to contain that value, liquid, on the server, has absolutely no idea about what is stored on your client's computers.

If you want help with the JS, then I don't mind.
Reply all
Reply to author
Forward
0 new messages