How can I use a JavaScript variable in liquid?

Hi Team , We are trying to use javascript variable in liquid but not working, please help us out how make ajax call in liquid combine ajax response and liquid value

thanks

Venkatesh M

Just an idea. Create hidden input field:


With your js add value to that field:

document.getElementById('myjsvar').value = yourJsVar;

I would like to update liquid value example search.results with my javascript response al or filter liquid search results based on my javascript response

thank you it worked for me

You’re welcome @venkateshm383 !

Glad I could help!