cancel
Showing results for 
Search instead for 
Did you mean: 

Stop form from submit

SOLVED

Stop form from submit

image.png

So i have to redo Ajax Cart for simple product as a home work, now i need to stop the page from redirect to check out after i press Add to cart button in category page. I have tried return false; and event.preventDefault(); on event submit to no avails. Can someone suggest me on what to do to achieve that. Many thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Stop form from submit

Figured it out myself, just change button attribute type='submit' to type='button' then use ajax to send product id to controller to add product to cart then use sections.xml to update the cart.

View solution in original post

1 REPLY 1

Re: Stop form from submit

Figured it out myself, just change button attribute type='submit' to type='button' then use ajax to send product id to controller to add product to cart then use sections.xml to update the cart.