Parsing liquid tag to JS

Highlighted
New Member
4 0 0
Trying to get a url string from a tag, meta_Image:<url>, assign it to a javascript variable but returns undefined.
 
 
{% for tag in product.tags %}
{% if tag contains "meta_Image" %}
{% assign url = tag | split:"meta_Image:" | last %}
<script>
$(document).ready(function(){
var m_Image = {{ url }};
var imageContainer = $(".rondell-container");
imageContainer.css('background-image','{{m_Image}}');
console.log(m_Image);
console.log("success")
});
</script>
{% endif %}
{% endfor %}
0 Likes