It goes to the correct if statement, but either way it always submits the form. I dont want it to submit if the statement is true, and if they press cancel I also don't want it to submit.
I also saw lots of similar questions, but none of their answers were the correct solution here.
My form html:
<form action="actual link here" method="POST" target="_blank" onsubmit="ordering()">
My js:
function ordering() {
if($('#total').html() == "$0.00") {
alert("You have not ordered anything. Please use our contact page if you wish to contact us.");
return false;
}
else {
return window.confirm("Are you sure?");
}
}