This might be an easy fix I am just not seeing, but I am trying to setup a basic delivery zone function. If you are in delivery zone, after you submit your zipcode an alert says you are in our zone and when you click ok, it takes you to the booking page. Else, say they are outside of the zone. I can't seem to get an onclick demand for the alert to take to the booking page. (P.S. All javacript brought into Squarespace)
<script type="text/javascript">
function IsValidZipCode() {
var zip = document.getElementById('txtZip').value;
var ZipArray = ["60543", "60188"];
var isValid = ZipArray.indexOf(zip); ;
(isValid );
if (isValid >= 0){
alert ('Nice! go ahead and book!')
// NEED TO LINK TO NEW WEBPAGE
return true;
}
else {
alert('Sorry, we do not offer delivery here at this time');
return false;
}
}
</script>
<form>
Please Enter Zip Code: <input id="txtZip" name="zip" type="number" />
<input onclick="IsValidZipCode()" id="Button" type="submit" value="Submit"/>
</form>