skip to Main Content

Accessing Shopify Liquid variables in Javascript

My question is, is it possible to do access the variables in Shopify Liquid using Javascript? {% assign my_array= "apples, oranges, peaches, tomatoes" | split: ", " %} function my_function(number){ return "{{my_array[number]}}"; } $('#click_me').click(function(){ alert(my_function(0)); }); I know this is…

VIEW QUESTION

JQuery AJAX GET method request not working

Whenever clicking the button, target file has fetched i.e. "demo.txt" (checked in network) but file content is not displaying, what's wrong? <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#button").click(function(){ $.ajax({url: "http://localhost/suman_php/JQ_AJAX/demo.txt", type:"GET", success: function(data,status){ alert(status); $("#div1").html(data); }}); }); });…

VIEW QUESTION
Back To Top
Search