Skip to content

Instantly share code, notes, and snippets.

@aphoenix
Created August 2, 2011 16:49
Show Gist options
  • Save aphoenix/1120632 to your computer and use it in GitHub Desktop.
Save aphoenix/1120632 to your computer and use it in GitHub Desktop.
IE is a pain in the butt.
$("#pocodesubmit").click(function(event) {
event.preventDefault();
var postalcode = $('#areaField').val().toUpperCase().replace(/ /g,'');
var regexObj = { canada : /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ]()?\d[ABCEGHJKLMNPRSTVWXYZ]\d$/i};
var regexp = new RegExp(regexObj.canada);
if (!regexp.test(postalcode)) { // This one triggers properly in IE.
$('.title').html('Please Enter a Postal Code');
} else { // This one does not trigger properly in IE.
alert('sending');
var thesearch = 'txt_search='+postalcode;
$.ajax({
type:"POST",
url:"<?php echo $this->getThemePath()?>/includes/elements/action_iya.php",
data:thesearch,
success: function() {
$('.title').html('Updating your Information');
$('.pcode').html(postalcode);
$('.inYourArea').addClass('hide');
$('.inYourArea.current').removeClass('hide').addClass('visible');
$.cookie('iya_postalcode', postalcode, {path: '/'});
location.reload();
}
});
}
return false;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment