I want to remove all products in my card without page refresh. I created and eventlistener, it fires when form submited. But it's now working I expecte, gives me that error.
const deleteCartItems = document.getElementById('deleteAllProduct');
deleteCartItems.addEventListener('submit',deleteAllCartItem)
function deleteAllCartItem(e) {
$.ajax({
type: 'DELETE',
url: "/cart/delete-products",
context: document.body,
success: function(){
Flash.success("Products successfully deleted");
}
});
e.preventDefault();
}