I have liquid code for shopify website that does following:
It displays email input field and a submit button where customers can write down their email and click on submit button (shown as subscribe) and their email addresses are
stored in shopify customers list. The problem with my code is that page is refreshed. I want a smooth flow when users click on “'Subscribe“ button, page refresh does not occur. I need a solution via AJAX request. How do I do it?
Any help will be appreciated. Thanks
Hi! Good question — this happens because the form is submitted normally, so the browser refreshes the page by default.
To avoid the page refresh, you’ll need to prevent the default form submission and send the data using **AJAX (fetch)**instead. Shopify supports this for customer creation/newsletter signup.