How can I retrieve metafield data for product variants using liquid code?

how i can get the metafield data for the product varients.
Kindly do reply if you guys have the solution.
Thanks.

Have you tried doing a loop on product variants?

{% for variant in product.variants %}
 {{variant.metafields.YOUR_NAMESPACE.YOUR_MFIELD}}
{% endfor %}

value is not changing when i am changing the varient.i want to change the value without loading tthe page.