This code works in every other browser EXCEPT IE8 on an XP machine. Can not for the life of me figure it out. In IE8 it will always display the error function. I have tried changing the dataType to jsonp, text, html, and no matter what it always pops the error function. Like I said, Chrome, Safari, Firefox, and all other IE's work, just not IE8.
<script type="text/javascript">
$("#zip").submit(function (e) {
e.preventDefault();
if ($(this).parsley('isValid') === true) {
var el = $("#zipcode");
if ((el.val().length == 5) && (is_int(el.val()))) {
$.ajax({
url: "http://zip.elevenbasetwo.com/v2/US/" + el.val(),
cache: false,
dataType: "json",
type: "GET",
success: function (result, success) {
console.log(result.state);
$('.rates-zip').fadeOut(function () {
switch (result.state) {
case "California":
$('#western').fadeIn();
break;
case "Illinois":
case "Virginia":
$('#midwest').fadeIn();
break;
case "New York":
case "New Jersey":
$('#eastern').fadeIn();
break;
case "Washington":
$('#northwest').fadeIn();
break;
default:
$('#default').fadeIn();
}
})
},
error: function (result, success) {
alert("Error IE8");
}
});
}
};
});
function is_int(value) {
if ((parseFloat(value) == parseInt(value)) && !isNaN(value)) {
return true;
} else {
return false;
}
}
</script>
Hoping someone might have a solution.