Skip to content

Instantly share code, notes, and snippets.

@spsaucier
Created July 20, 2013 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spsaucier/6044068 to your computer and use it in GitHub Desktop.
Save spsaucier/6044068 to your computer and use it in GitHub Desktop.
Check Delivery Postcode JS
$('#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