How to pass Javascript api request result variables to shopify liquid variable

Deadly 提交于 2020-01-06 07:44:10

问题


I have a javascript that makes a api call and gets a json response. I need to pass this to my liquid template and iterate over it.

How do i pass the result variable on get request to a shopify liquid variable.?

Thanks..!


回答1:


You cannot do that. Liquid is rendered Server Side... whereas your Javascript is considered to be client side coding. When you are rendering your Liquid, you can transfer Liquid into Javascript for use later, but not vice versa.

Also, if you are getting JSON via an API call and you need to iterate over it, why are you not just using Javascript. You do not need Liquid to iterate over data.



来源:https://stackoverflow.com/questions/25738337/how-to-pass-javascript-api-request-result-variables-to-shopify-liquid-variable

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!