Created
July 20, 2013 06:25
-
-
Save spsaucier/6044068 to your computer and use it in GitHub Desktop.
Check Delivery Postcode JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#checkDelivery').submit(function() { | |
var data = $(this).serializeArray(), | |
postcodes = [2015,2019,2015,2018,2011]; | |
jQuery.each(data, function(i, field){ | |
if ( $.inArray(parseInt(field.value), postcodes) != -1 ) { | |
$('#delivery_options').html('<p>Yes, we deliver to your area!</p>'); | |
} | |
else { | |
$('#delivery_options').html('<p>Unfortunately, we do not deliver to your area.</p>'); | |
} | |
}); | |
return false; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment